L_OcrPage_GetRecognizeStatistics

#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.

Returns

SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

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.
See Also
Functions: L_OcrPage_Destroy, L_OcrPage_FromBitmap, L_OcrPage_GetBitmap, L_OcrPage_SetBitmap, L_OcrPage_GetOverlayBitmap, L_OcrPage_SetOverlayBitmap, L_OcrPage_SetBitmapChangedCallback, L_OcrPage_IsInverted, L_OcrPage_GetRotateAngle, L_OcrPage_GetDeskewAngle, L_OcrPage_AutoPreprocess, L_OcrPage_AutoZone, L_OcrPage_GetZoneCount, L_OcrPage_InsertZone, L_OcrPage_AddZone, L_OcrPage_IndexOfZone, L_OcrPage_GetZoneAt, L_OcrPage_SetZoneAt, L_OcrPage_RemoveZone, L_OcrPage_RemoveZoneAt, L_OcrPage_ClearZones, L_OcrPage_GetZoneCells, L_OcrPage_SetZoneCells, L_OcrPage_HitTestZone, L_OcrPage_IsRecognized, L_OcrPage_Recognize, L_OcrPage_Unrecognize, L_OcrPage_GetRecognizedCharacters, L_OcrPage_SetRecognizedCharacters, L_OcrPage_FreePageCharacters, L_OcrPage_GetZoneWords, L_OcrPage_FreeWords, L_OcrPage_GetText, L_OcrPage_ExtractZoneMICRData, L_OcrPage_DetectLanguages, L_OcrPage_LoadZonesFile, L_OcrPage_SaveZonesFile, L_OcrPage_SaveXml, L_OcrPage_GetAutoPreprocessValues
Topics: Programming with LEADTOOLS OCR Advantage
Starting and Shutting Down the OCR Engine
Recognizing OCR Pages
Working With OCR Pages

Example

#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 engine 
   L_INT retCode = L_OcrEngineManager_CreateEngine(L_OcrEngineType_Advantage, &ocrEngine); 
   if(retCode != SUCCESS) 
      return retCode; 
   // Start the engine using default parameters 
   L_OcrEngine_Startup(ocrEngine, NULL, OCR_ADVANTAGE_RUNTIME_DIR); 
   // Load image to process 
   L_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 page 
   L_OcrPage_AutoPreprocess(ocrPage, L_OcrAutoPreprocessPageCommands_Deskew, NULL, NULL); 
   // AutoZone & Recognize the page 
   L_OcrPage_Recognize(ocrPage, NULL, NULL); 
   // Show the statistic about the last recognize operation 
   L_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; 
   //CLEANUP 
   if(bitmap.Flags.Allocated) 
      L_FreeBitmap(&bitmap); 
   if(ocrPage != NULL) 
      L_OcrPage_Destroy(ocrPage); 
   if(ocrEngine != NULL) 
      L_OcrEngine_Destroy(ocrEngine); 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Advantage OCR C API Help