With code:
import tesseract
api = tesseract.TessBaseAPI()
I have an error:
AttributeError:'module' object has no attribute 'TessBaseAPI'
used sudo apt-get install tesseract-ocr
Are you sure the right import isn't import pytesseract
?
If it's import tesseract
, did you installed the latest version of it and did you used pip ?
Maybe this link could help you.
Did you try this :
from tesserocr import PyTessBaseAPI
images = ['sample.jpg', 'sample2.jpg', 'sample3.jpg']
with PyTessBaseAPI() as api:
for img in images:
api.SetImageFile(img)
print api.GetUTF8Text()
print api.AllWordConfidences()