L_OcrPage_GetRecognizeStatistics

Summary

Gets some statistic information about the latest successful recognition process.

Syntax

#include "ltocr.h"

L_LTOCR_API L_INT EXT_FUNCTION L_OcrPage_GetRecognizeStatistics(page, statistic)

Parameters

L_OcrPage page

Handle to the OCR page.

L_OcrRecognizeStatistic* statistic

Address to L_OcrRecognizeStatistic structure to be updated with recognition statistics.

Returns

Value Meaning
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

See Also

Functions

Topics

Example

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_LEAD, &ocrEngine); 
   if(retCode != SUCCESS) 
      return retCode; 
 
   // Start the engine using default parameters 
   L_OcrEngine_Startup(ocrEngine, NULL, OCR_LEAD_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 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - LEAD Engine C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.