2

I'm working on an image classification task, and I am using Tesseract OCR for digit classification.

My main problem is receiving really poor results from the OCR for single digits.

After reading a lot online about improving Tesseract's performance, I am pre-processing the image with OpenCV using the following general scheme:

  1. finding contours
  2. bounding boxes
  3. cropping to the boxes to get single digits
  4. thresholding to get binary image
  5. padding the image by adding white background
  6. blurring.

I am getting something I'm fairly pleased with, for example:

I am calling Tesseract in the following way, emphasizing that I am expecting a single digit:

tesseract input.jpg output.txt - psm 10 digits 

I thought Tesseract would surely identify it correctly, but it returns ".".

Does anyone have ideas for further improvements? I'm guessing I could train Tesseract for this specific font, but since I would be dealing with different fonts I'm hoping for a better approach.

2
  • 1
    See my answer in stackoverflow.com/questions/34176517/… . Using newocr.com on your image fails, but works if multiple concatenations of your image are given (I tried with "66666666" and it worked). Commented Feb 1, 2016 at 15:27
  • Thanks for the tip. What I ended up doing, in light of what you said, was to put the single characters back into one image and then sending that image to the OCR, and for some reason it performed much better. Commented Feb 7, 2016 at 13:34

2 Answers 2

1

What version of Tesseract? It works for me (note: there should not be a space between '-' and 'psm').

$ tesseract ~/Downloads/6digit.jpg stdout -psm 10 digits 6 $ tesseract -v tesseract 3.05.00dev leptonica-1.71 libgif 4.2.3 : libjpeg 9a : libpng 1.6.21 : libtiff 4.0.6 : zlib 1.2.8 : libwebp 0.5.0 : libopenjp2 2.1.0 
Sign up to request clarification or add additional context in comments.

Comments

0

What I ended up doing, in light of what @micka commented, was to assemble all the single characters back into one image and then send that image to the OCR. For some reason which is still unclear to me, it really improves the results.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.