2
votes

To get some better results with the OCR library tesseract I would do some preprocessing, but haven't got the right idea what steps could help me.

enter image description hereenter image description here

I have tried to resize the image with the factor 15 and applied an adapted threshold (see images) but this results in "wavy" characters, which can't be detected with the tesseract OCR library. At the bottom you can find my Link to the images via Dropbox. The original image size is 115x18px, with an character height of 10px.

I would like to extract the characters from the background. What steps could lead to a better result? Should I use another OCR library instead of tesseract for the OCR part? What experiences in general have you made when using tesseract for text detection? Or can you prefer another library, or a commercial one?

Dropbox Link to example image

Update 19.6.15:

Original ImageOTSU Thresholded image

OTSU threshold delivers better results as adaptive threshold. Will give an update about the other answers in the next days!

Update 01.07.2015 Have another example image, where the serialnumber should be recognized with using tesseract. Since the font size is very small the recognition result is not very good. Any ideas what kind of methods could help here?

Another example image

4
Try look at Hough transform functions - Chathura Palihakkara
There are some scripts in here might be useful. fmwconcepts.com/imagemagick - Chathura Palihakkara

4 Answers

2
votes

Otsu threshold gives me better results here. Combining with distance transform and another threshold I even get something almost recognizable by tesseract.

enter image description here

This is the result I get:

6ANFK9PC)100'0-GT

0
votes

You may try to find all contours and remove contours with small area.
Dealing with "wevy" characters might be more complicated. The only idea i have right now is using distance transform and thresholding (using binary threshold) the result (finding good threshold value might not be simple - i would try using maxValue*0.25 of normalized distance transform).

0
votes

You may want to try a small amount of erosion and dilation on the second image, this might even out some of the waves in the characters, a mixture of both erosion/dilation will also remove the little white dots of noise surrounding them, which is always going to help OCR.

Check out this OpenCV documentation, which will provide you with some example code to get you started and an explanation of how it all works.

Hope this helps.

0
votes

Why not just "sharpen" (which will remove the white borders and thin the white lines) and then simply reverse the black and white?