#include "ltocr.h"
L_LTOCR_API L_INT EXT_FUNCTION L_OcrEngineManager_CreateEngine(engineType, engine)
Creates an instance of L_OcrEngine to use later on starting up the engine and some other functionality.
OCR engine type you wish to work with, currently L_OcrEngineType_LEAD is the only available engine.
Pointer to a L_OcrEngine handle to be updated with the initialized OCR engine handle. Use this handle for other OCR functionality.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
L_OcrEngineManager_CreateEngine must be called before calling any other LEADTOOLS LTOCR toolkit functions.
The user must unlock LEADTOOLS OCR Module - LEAD Engine using the L_SetLicenseFile function. If the LEADTOOLS OCR Module - LEAD Engine is locked then the L_OcrEngineManager_CreateEngine function will fail and will not initialize the OCR engine.
When the handle to the OCR engine is no longer needed, it should be freed by calling L_OcrEngine_Destroy. For every call to L_OcrEngineManager_CreateEngine there must be an associated call to L_OcrEngine_Destroy.
Required DLLs and Libraries
L_INT L_OcrEngineManager_CreateEngineExample()
{
// Create an instance of the engine
L_OcrEngine ocrEngine = NULL;
L_INT retCode = L_OcrEngineManager_CreateEngine(L_OcrEngineType_Advantage, &ocrEngine);
if(retCode != SUCCESS)
return retCode;
// Start the engine using default parameters
retCode = L_OcrEngine_Startup(ocrEngine, NULL, OCR_ADVANTAGE_RUNTIME_DIR);
if(L_OcrEngine_IsStarted(ocrEngine))
std::cout << "Engine started successfully.\n";
else
std::cout << "Engine failed to start.\n";
// Shutdown the engine
if(ocrEngine != NULL)
{
L_OcrEngine_Destroy(ocrEngine);
std::cout << "Engine shut down & destroyed.\n";
}
return retCode;
}