#include "ltocr.h"
L_LTOCR_API L_INT EXT_FUNCTION L_OcrEngineManager_CreateEngine(engineType, engine)
L_OcrEngineType engineType; | OCR engine type you wish to start |
L_OcrEngine* engine; | pointer to L_OcrEngine to be updated |
Creates an instance of L_OcrEngine to use later on starting up the engine and some other functionality.
Parameter | Description |
---|---|
engineType | OCR engine type you wish to work with, currently L_OcrEngineType_Advantage is the only available engine. |
engine | Pointer to a L_OcrEngine handle to be updated with the initialized OCR engine handle. Use this handle for other OCR functionality. |
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 OCR Advantage using the L_SetLicenseFile function. If the OCR Advantage 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
LTOCR For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
#define OCR_ADVANTAGE_RUNTIME_DIR TEXT("C:\\LEADTOOLS 19\\Bin\\Common\\OcrAdvantageRuntime")
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;
}