4

I've been trying to train tesseract engine to ocr images that have numbers written using the seven digital font.

Seven digital font

And, after searching, it turned out that tesseract won't ocr a segmented font unless the segments are somehow connected.

So, I used erosion, which is an opencv function, on the images to connect the segments. http://www.tutorialspoint.com/java_dip/eroding_dilating.htm

And, after that, I used thresholding to convert the image to binary before handing the image to tesseract (This step is redundant because tesseract internally does image binarization). http://docs.opencv.org/2.4/doc/tutorials/imgproc/threshold/threshold.html

My main problem is that the numbers are written in black on a dark green background. Here are the results

Original image:

Original Image to be ocred

Method 1: After Erosion and binarization (I tried various threshold max values) Image after binarization

Method 2: I tried to use k-means or c-means algorithms but the results were no much better.

Method 3: I also tried adaptive Gaussian thresholding Adaptive Gaussian threshold

Method 4: Adaptive Mean Just adaptive mean

Method 5: Handing the original image to tesseract without any image processing and outputting the result image (Tesseract uses leptonica to do image processing internally). Tesseract image processing

I also tried various samples instead of this one and tried Gimp to enhance the images using the steps in Gimp image processing, but nothing is working for me. Any suggestions? Thanks!

Community
  • 1
  • 1
  • 1
    Can you get better input images? i.e. less shiny/dark spots across the image.. similar brightnesses, because this is probably you're main enemy, hence on the last image the dark splodge on the left and the light on the right – TheLethalCoder Nov 12 '15 at 12:25
  • Yes, I know, but I can't control the conditions when the images are taken, so I can't assume that I will have perfect shots. I've had some good results on some samples, but the majority of the samples can't be ocred, so I thought that maybe there is some green filter to apply, or something that I can do. Thank you @TheLethalCoder – Abdulmajeed Al-Kattan Nov 14 '15 at 09:10
  • If the images are that poor you can always threshold at multiple values, get the ocr data then using the positional information of the characters add up the results of each value, extra work but could be a decent workaround – TheLethalCoder Nov 14 '15 at 10:27
  • I will try your suggestion and see what I can get. – Abdulmajeed Al-Kattan Nov 14 '15 at 11:13
  • @AbdulmajeedAl-Kattan did you solve it? – zacheusz Apr 30 '18 at 00:20

0 Answers0