Single-digit number-OCR

I am working on a desktop application using Nitro where a search for an expression is done and OCRExtractrelative is used to retrieve the number of times it is found. It works fine when the number of times the expression is found has two or more digits. However, when it has only one digit, OCRExtratcRelative cannot extract the value and returns blank. I tried to have a specific image and OCRExtractRelative for only one digit with several different positions for the green and pink boxes but, unfortunately, it doesn’t work. This is one issue.

I tried to run with Engine 2 but it does not work either.

Please find attached the screenshots you asked for.

Thanks for your prompt reply!

The screenshots are useful. They helped us to identify the OCR issue: The pink area is too small. In general, a bit more area and some words as context help with number OCR accuracy.

Test: I tried with two different pink boxes:

(1) Number plus some text (recommended) => works fine even with single digit numbers! After OCR, you can then remove the text that you do not need with string split.

gettext_dpi_168

(2) Just number => This avoids the need for string split, but makes the OCR less reliable, especially for single digit numbers. The OCR might think that this lonely number is not a character and ignores it.
justnumber_dpi_168

Here is a screencast of my test. To test, I drop your images into a browser and then run desktop automation on it:

Hint: At 1:05 in the video I switch to the Screenshot tab to show that you can always use “_lastscreenshot.png” to verify what image gets actually sent to the OCR engine. And if needed you can then export this image and test the OCR directly with the online ocr page - that can be useful for debugging OCR issues.

See also: OCRExtractRelative: A larger pink box OCR area is usually better

2 Likes

Hi admin
I thought I had thanked you, but hadn’t. I am sorry about that.
Your suggestion worked fine, thank you.

There is a small issue, though. When the number read is 9, the OCR reads it as the letter g. Not a big deal once you know it. I put a little workaround in place for this case. But if it can be fixed, it will be nicer.

Thanks again!