###pyocrのコードをそのまま流しているのにエラー
lang
1from PIL import Image 2import sys 3 4import pyocr 5import pyocr.builders 6 7tools = pyocr.get_available_tools() 8if len(tools) == 0: 9 print("No OCR tool found") 10 sys.exit(1) 11# The tools are returned in the recommended order of usage 12tool = tools[0] 13print("Will use tool '%s'" % (tool.get_name())) 14# Ex: Will use tool 'libtesseract' 15 16langs = tool.get_available_languages() 17print("Available languages: %s" % ", ".join(langs)) 18lang = langs[0] 19print("Will use lang '%s'" % (lang)) 20# Ex: Will use lang 'fra' 21# Note that languages are NOT sorted in any way. Please refer 22# to the system locale settings for the default language 23# to use. 24 25txt = tool.image_to_string( 26 Image.open('iroha.png'), 27 lang="jpn", 28 builder=pyocr.builders.TextBuilder(tesseract_layout=6) 29) 30print( txt ) 31# txt is a Python string 32
エラー
Traceback (most recent call last): File "ocr.py", line 28, in <module> builder=pyocr.builders.TextBuilder(tesseract_layout=6) File "C:\Users\jun_endo\AppData\Local\Continuum\anaconda3\lib\site-packages\pyocr\tesseract.py", line 367, in image_to_string raise TesseractError(status, errors) pyocr.error.TesseractError: (1, b'Error opening data file C:\Program Files (x86)\Tesseract-OCR\tessdata/jpn.traineddata\r\nPlease make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory.\r\nFailed loading language \'jpn\'\r\nTesseract couldn\'t load any languages!\r\nCould not initialize tesseract.\r\n')
このエラーの意味と、
解決方法を教えてください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。