2016-09-20 1 views
0

イメージからテキストを取得するために、Python(2.7、Windows OS)でOCRスクリプトを作成しようとしています。最初に私はPyTesserをダウンロードしてPython27/Lib/site-packagesに 'pytesser'として抽出し、pip install tesseractでtesseractをインストールしました。それから私は、self.pyとして次のスクリプトを書いた:ファイル 'tesseract.log'がありません(Python 2.7、Windows)

from PIL import Image 
from pytesser.pytesser import * 

image_file = 'C:/Users/blabla/test.png' 
im = Image.open(image_file) 
text = image_to_string(im) 
text = image_file_to_string(image_file) 
text = image_file_to_string(image_file, graceful_errors=True) 
print text 

をしかし、私は次のエラーを取得しています:

Traceback (most recent call last): 
    File "C:/Users/blabla/self.py", line 7, in <module> 
    text = image_file_to_string(image_file) 
    File "C:\Python27\lib\site-packages\pytesser\pytesser.py", line 44, in image_file_to_string 
    call_tesseract(filename, scratch_text_name_root) 
    File "C:\Python27\lib\site-packages\pytesser\pytesser.py", line 24, in call_tesseract 
    errors.check_for_errors() 
    File "C:\Python27\lib\site-packages\pytesser\errors.py", line 10, in check_for_errors 
    inf = file(logfile) 
IOError: [Errno 2] No such file or directory: 'tesseract.log' 

そして、はい、どこにも「tesseract.log」ファイルはありません。私は何をすべきか?この問題をどのように解決すればよいですか?

ありがとうございます。

注:私はCにたTesseractからpytesser.pyからラインtesseract_exe_nameを変更しました:/ Python27/libに/のsite-packages/pytesser/たTesseractが、それは動作しません。

編集:さてさて、私は単に「pytesser」であり、それは「tesseract.log」ファイルを作成したが、私はまだ同じエラーを取得していますteseract.exeをrunnedました。

答えて

0

私は../pytesser/errors.pydef check_for_errors(logfile = "tesseract.log"):からdef check_for_errors(logfile = "C:/Python27/Lib/site-packages/pytesser/tesseract.log"):に行を変更しましたし、それが働きました。

関連する問題