#include "ltocr.h"
L_LTOCR_API L_INT EXT_FUNCTION L_OcrPage_GetRecognizeStatistics(page, statistic)
| L_OcrPage page; | handle to the OCR page |
| L_OcrRecognizeStatistic* statistic; | address to L_OcrRecognizeStatistic structure to be updated with recognition statistics |
Gets some statistic information about the latest successful recognition process.
| Parameter | Description |
|---|---|
| page | Handle to the OCR page. |
| statistic | Address to L_OcrRecognizeStatistic structure to be updated with recognition statistics. |
| SUCCESS | The function was successful. |
| < 1 | An error occurred. Refer to Return Codes. |
Gets some statistic information about the latest successful recognition process.
You can use this method after calling L_OcrPage_Recognize to get some statistic information about the latest successful recognition process like number of recognized characters, words and rejected characters.
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 MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName#define OCR_ADVANTAGE_RUNTIME_DIR TEXT("C:\\LEADTOOLS 19\\Bin\\Common\\OcrAdvantageRuntime")L_INT L_OcrPage_GetRecognizeStatisticsExample(){BITMAPHANDLE bitmap = { 0 };L_OcrEngine ocrEngine = NULL;L_OcrPage ocrPage = NULL;// Create an instance of the engineL_INT retCode = L_OcrEngineManager_CreateEngine(L_OcrEngineType_Advantage, &ocrEngine);if(retCode != SUCCESS)return retCode;// Start the engine using default parametersL_OcrEngine_Startup(ocrEngine, NULL, OCR_ADVANTAGE_RUNTIME_DIR);// Load image to processL_LoadBitmap(MAKE_IMAGE_PATH(L_TEXT("Ocr1.tif")), &bitmap, sizeof(BITMAPHANDLE), 0, ORDER_RGB, NULL, NULL);L_OcrPage_FromBitmap(ocrEngine, &ocrPage, &bitmap, L_OcrBitmapSharingMode_AutoFree, NULL, NULL);bitmap.Flags.Allocated = 0;// Process the pageL_OcrPage_AutoPreprocess(ocrPage, L_OcrAutoPreprocessPageCommands_Deskew, NULL, NULL);// AutoZone & Recognize the pageL_OcrPage_Recognize(ocrPage, NULL, NULL);// Show the statistic about the last recognize operationL_OcrRecognizeStatistic pageStatistics;pageStatistics.StructSize = sizeof(L_OcrRecognizeStatistic);L_OcrPage_GetRecognizeStatistics(ocrPage, &pageStatistics);std::cout << "Recognized characters: " << pageStatistics.RecognizedCharacters << std::endl;std::cout << "Recognized words: " << pageStatistics.RecognizedWords << std::endl;std::cout << "Rejected characters: " << pageStatistics.RejectedCharacters << std::endl;//CLEANUPif(bitmap.Flags.Allocated)L_FreeBitmap(&bitmap);if(ocrPage != NULL)L_OcrPage_Destroy(ocrPage);if(ocrEngine != NULL)L_OcrEngine_Destroy(ocrEngine);return SUCCESS;}