Tesseract image thresholding

904 views
Skip to first unread message

Rufus

unread,
Mar 15, 2012, 6:27:00 AM3/15/12
to tesseract-ocr
Hello everyone,

There is something which I don't quite understand about how tesseract
works internally.

I've taken a photo with my mobile phone camera, and the image contains
some digits.
Now tesseract is not able to recognize these digits.

However, if I do simple thresholding on the image with imagemagick
before feeding it to tesseract, then tesseract recognizes the digits
perfectly.

As tesseract has already an internal thresholding mechanism, shouldn't
it recognize the digits without manual thresholding?

Thanks

Mayur Mudigonda

unread,
Mar 21, 2012, 6:14:06 AM3/21/12
to tesser...@googlegroups.com
Can you post your images?

It's hard to comment without any images. What resolution are you working with?

Rufus

unread,
Mar 21, 2012, 3:05:09 PM3/21/12
to tesser...@googlegroups.com
I am trying to recognize digits only.
B.jpg is the picture taken by a mobile phone camera.

Then I process the image with ImageMagick:
convert B.jpg -threshold 30% B_thres_30.tiff
convert B.jpg -threshold 40% B_thres_40.tiff

For OCR, I use the commands:
tesseract B.tiff B -psm 8 nobatch digits
tesseract B_thres_30.tiff B_thres_30 -psm 8 nobatch digits
tesseract B_thres_40.tiff B_thres_40 -psm 8 nobatch digits

Now, without manual preprocessing, tesseract outputs an empty file. I find it strange because tesseract should perform some kind of thresholding.
The only explanation for me is that the thresholding of tesseract might not be that good.

With a 30% threshold, the output text of tesseract is: 5-50      (obviously this threshold is suboptimal)
With a 40% threshold, the output text of tesseract is: 5.50      (optimal threshold)

Any clues why tesseract's own thresholding is not working well?

Thanks,
images.zip
Reply all
Reply to author
Forward
Message has been deleted
0 new messages