I am using windows 10 and tesserocr version is 2.4. Want to detect text from an image and then the language of that text.
While running this piece of code:
from tesserocr import PyTessBaseAPI
import argparse
parser = argparse.ArgumentParser("Enter Image Path")
parser.add_argument('-i' , '--image' , help="Image Path")
args, unknown = parser.parse_known_args()
images = ['b.jpg']
images[0] = args.image
count = 0
count2 = 0
count3 = 0
with PyTessBaseAPI() as api:
for img in images:
api.Init(lang = 'eng')
api.SetImageFile(img)
# print api.AllWordConfidences()
arr = list(api.AllWordConfidences())
sumarr = sum(arr) / float(len(arr))
Getting below error :
<ipython-input-3-152e90ab44c3> in <module>
13 count2 = 0
14 count3 = 0
---> 15 with PyTessBaseAPI() as api:
16 for img in images:
17 api.Init(lang = 'eng')
tesserocr.pyx in tesserocr._tesserocr.PyTessBaseAPI.__cinit__()
tesserocr.pyx in tesserocr._tesserocr.PyTessBaseAPI._init_api()
RuntimeError: Failed to init API, possibly an invalid tessdata path: C:\Users\hp\Anaconda3\/tessdata/
Anyone aware of this issue ?
