ImageGear for C and C++ on Windows v19.10 - Updated
IG_REC_initialize
API Reference Guide > Recognition Component API Reference > Recognition Component Functions Reference > Initialization and Cleanup Functions > IG_REC_initialize

Initializes the Recognition component.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_REC_initialize(
   AT_VOID 
);

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

This function does not process image pixels.

Example:

 
Copy Code
AT_ERRCOUNT ErrCount = 0;
ErrCount += IG_REC_initialize();

//...

ErrCount += IG_REC_close();

Recognition component requires additional resource files to be available. By default the component looks for these files in Resource\Recognition directory relatively to the location of igcore19d.dll (this path can be obtained via the "COMM.PATH" global control parameter). If the resource files do not exist in the default directory, the component looks for them in the directory where igcore19d.dll is located. If the files are not found in the latter directory, the function sets an error and returns a non-zero value.

The user may want to keep resource files in another location. Use "REC.RESOURCE_PATH" global control parameter to set full path to the user-defined resource directory. The parameter must be set before the call to IG_REC_initialize().

Example:

 
Copy Code
AT_ERRCOUNT ErrCount = 0;
static char* path = "C:\\Program Files\\Accusoft\\ImageGear v19 DLL\\DLL\\Bin";

IG_gctrl_item_set("REC.RESOURCE_PATH", AM_TID_MAKELP(AM_TID_CHAR), path, strlen(path) + 1, NULL);
ErrCount += IG_REC_initialize();

//...

ErrCount += IG_REC_close();

If user-defined resource path is specified, but there is no resource files in that directory, IG_REC_initialize() sets an error and returns a non-zero value. Setting "REC.RESOURCE_PATH" control parameter to NULL will tell the component to look for the resource files in the default location, as described above.

REC.RESOURCE_PATH parameter does not support relative paths.

Remarks:

Call this function after attaching the Recognition component to ImageGear, and before calling any other function of the Recognition component.

All objects that require Recognition API calls for their deletion, such as HIG_REC_IMAGE, HIG_REC_DOCUMENT, settings collections, AT_REC_LETTER arrays, wide string arrays, etc. must be deleted before the call to IG_REC_close. After IG_REC_close has been called, no Recognition API calls are allowed, except IG_REC_initialize, which initializes the component again.

If an ImageGear license includes the OCR "Plus" feature (Formatted Output), and redistributables required for that feature are not available, the Recognition component will fail to initialize. Make sure to select the "Recognition (Formatted Output)" option when running the Deployment Packaging Wizard. See also Distributing Recognition Engine Files for the Formatted Output Feature section for more information.