Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried to run OCR on multiple scanned sheets with numbers like this image (All with same background, digits only):

enter image description here

But all trials failed! I tried offline OCRs: gocr, tesseract and couple of online OCRs; but all TOTALLY failed!

What should I do?

share|improve this question
up vote 8 down vote accepted

First you must tweak those images. I recommend a batch tool like XnViewMP which is free and multiplatform.

It has a file explorer. Select all your images, then go to Tools - Batch convert. Add actions like I did:

XNViewMP - Batch convert - Actions tab

Here are my actions:

  1. HLS - make it grayscale:
    • Hue: 0
    • Lightness: 0
    • Saturation: -127
  2. Levels - lower black level a bit so that the gray noise will disappear
    • Black point: 0
    • White point: 212 - may vary depending on image
  3. Reduce noise filter
  4. Adjust for increasing the contrast
    • Brightness: 0
    • Contrast: 127 - this one matters
    • Gamma: 1.06
  5. Minimum for making the black thicker
    • Filter size: 5x5 - may vary depending on image

Don't forget to save as tiff (See Output tab). After that I run tesseract:

tesseract test.tif text -psm 7

Note I selected PSM mode 7: Treat the image as a single text line. If you have multiple lines you'll probably need to use mode 6 or 3.

And here are the contents of text.txt output file:

570 394 666 638 043
share|improve this answer
I wonder if those actions can also be done with GraphicsMagick. – Cristian Ciupitu Jun 19 '14 at 21:02

I tried to recognise your image with OCR technology by ABBYY: OCR SDK result

More information about ABBYY's products you can find at
I work for ABBYY and ready to help, if you have questions.

share|improve this answer
Is there a digits-only mode? To increase detection rate of scratched images? – ItsMe Jul 15 '14 at 13:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.