How to improve results of tesseract to recognize numbers - iPhone

1,729 views
Skip to first unread message

Wojciech Radomski

unread,
Jan 7, 2011, 9:02:39 AM1/7/11
to tesser...@googlegroups.com

Hi, I am working on iPhone application that recognizes ISBN numbers (ISBN: 978-83-7380-900-0) I use tesseract for this, but it is not working very well. I can see other applications, using same engine to work better.

to limit the characters i use this config line: tess->SetVariable("tessedit_char_whitelist", "SN:0123456789X-"); so all "I" are converted to "1", and "B" to 8. Using this it wont make mistake with those letters, whick are not important to me. After that i use regular expression to find the correct part of recognized text.

I also crop the image, so tesseract recognizes only part of the image, where isbn is visible (i placed color rect on camera overlay, so user have to place code in correct place) I also resize the image to 1000px width (also tried other sizes)

It works quite well when the light is excellent, but it is really hard to recognize correctly when the lighting isn't perfect.

The last digit of isbn number is a control sum.

What can I do to make it work better? Is there any way to say tesserect to recognize text only in given regular expression? Maybe i should do something with image first?

Sample images, that are not recognized correctly:
http://img412.imageshack.us/i/img0367si.jpg/
http://img264.imageshack.us/i/img0361d.jpg/

At the moment I am also making pictures at 2x zoom so camera is not so close to the object. It gives better results, but it is easier to move the camera and take fuzzy image.

Wojciech Radomski

unread,
Jan 7, 2011, 11:17:17 AM1/7/11
to tesser...@googlegroups.com
i used some pre processing and results are quite good at the moment. (normalisation and auto threshold) 
The only problem is that it is really easy to make fuzzy image, and then it is imossible to recognize anything.
The process of ocr recognition takes aproximately 4s. and it works on image 300 x 109 : 19KB
I am just wondering what can i do do make it working faster, so i would be able to take several images and process all of them.

salahuddin pasha (salahuddin66)

unread,
Jan 7, 2011, 11:47:01 AM1/7/11
to tesser...@googlegroups.com
Hello

Previously I was able to increase its performance by using
graphicsmagick (you can also use imagemgick instead).

http://www.graphicsmagick.org/

Simply download source in Mac OSX and compile.


Explore the following option to apply a pre-processor from terminal:

gm convert -magnify
gm convert -sharpen 6x1
gm convert -gamma 2
gm convert input.png -gamma 2 -colors 2 output.bmp
bmp2tiff -c none main.bmp main.tif
tesseract main.tif result -l eng


But applying these type of filter to all images wont be a good idea!
(note you also may need to install bmp2tiff/similar tool in Mac OSX)


You can also try with BARCODE!!! reader library, if available. :)


regards
Salahuddin

salahuddin66.blogspot.com

> --
> You received this message because you are subscribed to the Google
> Groups "tesseract-ocr" group.
> To post to this group, send email to tesser...@googlegroups.com.
> To unsubscribe from this group, send email to tesseract-ocr
> +unsub...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/tesseract-ocr?hl=en.


Reply all
Reply to author
Forward
0 new messages