Why is Tesseract unable to recognize the digits in these two images?

248 views
Skip to first unread message

Sean Leffler

unread,
Nov 19, 2015, 1:26:07 PM11/19/15
to tesseract-ocr
Hello! I'm new to Tesseract and I'm trying to use it to read text which will always be similar to these three images (always in the same font and with similar, relatively noise-free backgrounds.) I'm aware the images are very small; however, what puzzles me is that Tesseract seems to be perfectly fine with the image I've attached under the name "working.png". For the other two, it fails to detect any text. Is there anything I could do to improve this? I've tried scaling up the images and that didn't seem to do anything. Thanks in advance!
debug.png
debug2.png
working.png

Dmitri Silaev

unread,
Nov 19, 2015, 1:44:52 PM11/19/15
to tesser...@googlegroups.com
For "debug.png", I'd suggest first inverting the image, then running Tesseract in the single text line segmentation mode (7), or modes 8/10.

For "debug2.png", running Tesseract with the "-psm 7" option is enough but I advise to invert all such images because Tess often may confuse foreground and background pixels - usually foreground is black.

Example command line: tesseract debug_i.png debug_i.png -psm 7

Tested with Tess executable built as of 20150203.

Best regards,
Dmitri Silaev
www.CustomOCR.com





On Thu, Nov 19, 2015 at 8:04 PM, Sean Leffler <se...@errno.com> wrote:
Hello! I'm new to Tesseract and I'm trying to use it to read text which will always be similar to these three images (always in the same font and with similar, relatively noise-free backgrounds.) I'm aware the images are very small; however, what puzzles me is that Tesseract seems to be perfectly fine with the image I've attached under the name "working.png". For the other two, it fails to detect any text. Is there anything I could do to improve this? I've tried scaling up the images and that didn't seem to do anything. Thanks in advance!

--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To post to this group, send email to tesser...@googlegroups.com.
Visit this group at http://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/5fe49e71-5f55-4fb2-b1af-3097ceee4bc7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

debug_i.png.txt
debug2.png.txt
debug_i.png
debug2.png

Sean Leffler

unread,
Nov 19, 2015, 9:33:58 PM11/19/15
to tesseract-ocr
Thank you so much for your help! Inverting the images did wonders. I also resized them further, and did some filtering to try and get a little bit of the pixelation to go away. Since I'm using some Python bindings instead of the command line I didn't have immediate access to the other options you used. I think I'll add those into the bindings and submit a pull request. Thanks again!

Cheers,
Sean
Reply all
Reply to author
Forward
0 new messages