3

I am new to text extraction.when i try to extract text from a png image using pytesseract as

from PIL import Image
import pytesseract
s=Image.open('d:\\test.png')
print(pytesseract.image_to_string(s))

I am getting error as enter image description here Is this the problem of image(test.png).the test.png is the image of a number plate.Should i need to install anything else.

Emmanu
  • 749
  • 3
  • 10
  • 26

1 Answers1

5

according to the PyPi information there is a perquisite that you are missing:

Install google tesseract-ocr from http://code.google.com/p/tesseract-ocr/ . You must be able to invoke the tesseract command as "tesseract". If this isn't the case, for example because tesseract isn't in your PATH, you will have to change the "tesseract_cmd" variable at the top of 'tesseract.py'.

and that link redirected me to https://github.com/tesseract-ocr/tesseract

I'm frankly disappointed that the package doesn't give you a more informative message that you are missing this, anyway once you have installed the underlying tesseract command pytesseract should work correctly :)

Tadhg McDonald-Jensen
  • 20,699
  • 5
  • 35
  • 59
  • 2
    @it worked.Thanks.I installed tesseract-ocr from https://sourceforge.net/projects/tesseract-ocr-alt/files/ – Emmanu Apr 23 '16 at 18:02