Unexpected OCR text extraction behavior


#1

I use free OCR API to extract text fron images. Tested 2 simple images

and

Image1 extracts 4 fields as expected. Image2 extracts only 3 fields - last cell (‘33’) missed. A bit strange. Images look similar - results are different. OCR online and my C# application give the same outcome. In apllication I applied scale=true&isTable=true&fileType=“JPG”.

What can be done to assure expected OCR behavior for both images?


#2

Here are 3 ideas you can try (+ my results):

  • Use a different OCR language. Especially Chinese or Korean give often good results for number OCR. (Note: I did a quick test and this is did not improve the OCR result in your case)

  • Increase the image area you send for OCR. This gives the OCR algorithms more context. I can not try this suggestion myself, as I don’t have the “larger picture”.

  • the image is small. You can pre-process it and increase the size by e. g. 200%. This is worked well in my test - all four numbers are recognized.


#3

Oh, thank you for looking at the problem.

200% enalargement definiely improved processing. My sample works perfectly now. But more testing detected a lot of similar images where processing fails. Eg
.

This is 200% enlarged image. OCR fails to recognise ‘91’ cell.

Looking further I processed image through Windows 10 Photo enhacement After this OCR perfectly extracted text from enhanced image. I made some research on C# Image processing. Looked at [https://blogs.msdn.microsoft.com/dotnet/2017/01/19/net-core-image-processing(https://blogs.msdn.microsoft.com/dotnet/2017/01/19/net-core-image-processing/) and tested MagicScaler. See image after MagicScaler processing below

Frankly I see no difference between 2 images but OCR API does Second image processed correctly.

I run dozens more tests with MagicScale processing all worked except one which I put below

This image is 200% enlarged by MagicScale. Last cell (‘6’) missed in OCR processing. May be you can suggest something about this.

I would be very grateful for the further ideas how improve OCR API text recognition.


#4

Interesting results. It is a known issue for OCR software that “stand-alone” single digit numbers are tricky.

But here is another idea: To improve this further, can you make the image cut-out area bigger?

Example: Even so actually you only need the data from this part:
o2

try a larger area screenshot like this:
o1

It often gets better results for the same text than a smaller snippet with less surrounding text.