Clear document, but very bad unpredictable recognition

Hi Support Team,

We developed and tested application based on Aspose products (OCR, PDF, Imaging).
The quality and format of all scanned documents that have to be recognised are the same.
We work with a small table form with only 5 parameters (invoice #, date, customer ref, account number). However, we found out that the quality of recognition SIGNIFICANTLY differentiate from very similar documents by some reasons.
Could please advise on this issue?
Kind regards,
Julia

@juliavi.work

Would you please share the sample image with us for which the API is not recognizing text correctly. We will test the scenario in our environment and address it accordingly.

@juliavi.work

Thanks for sharing the sample files.

What is on the link of Google Docs? It is inaccessible. Also, could you please share the complete sample code snippet that you are using to process these PDF files? Are you converting these PDFs to images and performing OCR operation on them?

Hi Asad,
Please find snippets attached.

  1. Getting images from PDF by Aspose.Pdf
  2. Getting skewAngle of image from pdf
  3. Recognition process by value’s rectangles // Rectangles has accurate coordinates for each significant areas
    image_2021_04_01T06_51_42_277Z.png (20.4 KB)
    image_2021_04_01T06_50_21_894Z.png (6.8 KB)
    image_2021_04_01T06_49_05_423Z.png (16.3 KB)

Google docs file demonstrated our system results, I’ll attach a few snippets here:
However the parts that use letters demonstrated really bad results. We tried to use different resolution (600,300,200dpi) but it didn’t show any difference in recognition.

Screen Shot 2021-04-01 at 8.24.15 pm.jpg (275.0 KB)
Screen Shot 2021-04-01 at 8.23.38 pm.jpg (285.5 KB)

@juliavi.work

We are testing the scenario in our environment by using the code snippet that you have shared. However, we were unable to find the usage of skew angle in your code that you extracted using Aspose.Imaging. Also, the list of rectangles i.e. listRectangles is not defined anywhere in the code that you have shared.

Please check the below final code snippet that we were able to prepare from the screenshots:

// Convert Images
var result = new List<Stream>();
var docPdf = new Document("491246-4-pages.pdf");
// max 4 pages for demo
var cntPages = Math.Min(4, docPdf.Pages.Count);

foreach(Page page in docPdf.Pages)
{
 foreach(var img in page.Resources.Images)
 {
  if(Math.Max(img.Width, img.Height) > 800)
 {
   var ms = new MemoryStream();
   img.Save(ms, ImageFormat.Jpeg);
   result.Add(ms);
  }
 }
}

foreach (MemoryStream ms in result)
{
 var ocr = new AsposeOcr();
 RecognitionSettings rs = new RecognitionSettings();
 rs.AutoSkew = true;
 rs.DetectAreas = true;
 rs.RecognizeSingleLine = false;
 rs.Language = Language.Eng;
 var extractedText = ocr.RecognizeImage(ms, rs);
 Console.WriteLine(extractedText.RecognitionText); // EHNYWFSSZIYSSeei
}

Please note that we need to replicate the same issue at our end that you are facing and for the purpose, we need complete sample code snippet that is able to demonstrate that. As per your particular scenario and shared files, it would really be helpful if you could please share a sample console application. It would help us in replicating the same issue at our end and address it accordingly.

Hi Asad,
We’ll attach the code later today, hope it will be helpful for you to check.
Please test these files (I’m attaching the files and recognition results)
501495.pdf (872.2 KB)
501584.pdf (1.1 MB)
Screen Shot 2021-04-07 at 9.52.49 pm.png (95.5 KB)

@juliavi.work

Thanks for sharing more files.

We have checked them and noticed the recognition results as well. Please take your time to share the complete sample code snippet which can be executed to test and replicate the scenario. We will further proceed to assist you accordingly.