How to check if image quality is sufficient to perform OCR


Images submitted to FlexiCapture SDK for processing may differ in quality. Is there a way to check if image quality is sufficient to perform OCR?



Yes, it can be done with FlexiCapture SDK.

The ImageProcessingTool object provides a variety of methods for analyzing and preprocessing submitted images, including the IImageProcessingTools::CalcSuitableForOcr method. An ImageProcessingTools object can be obtained by calling the CreateImageProcessingTools method from an Engine object.

The CalcSuitableForOcr method returns a double value in the interval from 0.0 to 1.0 that indicates how suitable the image is for OCR, with 0.0 being the worst score and 1.0 the best.

To identify images whose quality is insufficient, the return value would be compared to some threshold value. The threshold value can be set to any value in the same interval from 0.0 to 1.0. The optimal threshold value should be determined separately for each processing scenario based on the actual images submitted for processing.

C# code snippet:

// Create an ImageProcessingTools object
FCEngine.IImageProcessingTools ipt = engineTools.Engine.CreateImageProcessingTools();
// Open an image file that needs to be checked
string imgFilePath = "path\to\the\file";
FCEngine.IImageFile imgFile = ipt.OpenImageFile(imgFilePath);
// Obtain the OCR suitability score for each page
for( int iPage=0; iPage<imgFile.PagesCount; iPage++ )
  FCEngine.IImage img = imgFile.OpenImagePage(iPage);
  double ocrSuitabilityScore = ipt.CalcSuitableForOcr(img);
  // Do something based on the score value

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request



Please sign in to leave a comment.