Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c# OCR can't recognize digits (tesseract 2)

Tags:

c#

ocr

tesseract

I'm trying to extract digits from the following:

It fails, I get a ~ in return. I'm using google's tesseract 2, using C# (open source c# wrapper) and now I'm wondering, is this image too crappy to be used for OCR?

Because imho the digits are straight clear.

Do you have any other OCR engine in mind that would nail this down?

EDIT

I've also tried with Asprise OCR (http://asprise.com/product/ocr/selector.php) but it fails to parse the image too...

like image 945
CoolStraw Avatar asked Feb 25 '23 16:02

CoolStraw


2 Answers

I suggest resizing. I zoomed this page to 200% in IE, Took a screenshot, printed it to PDF and imported it into my program that uses tessnet. Tess nailed it! Unless I read the #s wrong :-)

Although confidence = 140 (under 100 is preferred if you wondered). Of course When i tried the original size, I didn't get ~; I got about 1/2 the #s right, a bunch of letters, and other garbage. Not good enough, but better.

t2 seems to like images a certain size.

My program does processing to get that to work. Suggest using .net GDI+ for converting to 32 bit, resizing with Interpolation mode High Quality Bicubic. This seems to 'fill in the gaps' a bit.

Play with sizes that work - I have found, too big, or too small, and tesseract performs differently.

Both issues are preprocessing, that's easy and you'd thing tesseract would try; however, I know how to resize and interpolate; I don't know how to OCR! So I am willing to settle.

like image 73
FastAl Avatar answered Feb 27 '23 06:02

FastAl


Your image's resolution is too low -- 96 DPI, perhaps it is a screenshot. Rescale it to 300 DPI, and tessnet2 should be able to recognize it.

like image 25
nguyenq Avatar answered Feb 27 '23 07:02

nguyenq