Search code examples
ocrtesseract

Tesseract can't recognize simple numbers


enter image description here

$ tesseract pin3.png output
$ cat output.txt


bon 9 no Us

(oe


// expect 

391 
205
786
 4

I think the image is not complicated, but tesseract doesn't recognize the numbers of image. I thought perhaps number's colors are white, so I tried to change number color to black but result is same. How can I make tesseract recognize that kinds of image?

Thanks

-- As you can see, This is not single word


Solution

  • Preprocess image:

    1. invert
    2. binarize

    enter image description here

    tesseract numpad_.png - --psm 6
    Warning: Invalid resolution 0 dpi. Using 70 instead.
    3 9 1
    2 0 5
    7 8 6
    
    4