2017-03-27 11 views
3
from PIL import Image 
from tesseract import image_to_string 

print image_to_string(Image.open('C:\Users/Uzel/Desktop/pythonfoto/denklem.png')) 
print image_to_string(Image.open('C:\Users/Uzel/Desktop/pythonfoto/denklem.png'), lang='eng') 

私はこのコードをtesseract orcをインストールした後に使用します。Windows 8.1(win64)(Visual Studio 2012 + python + anaconda)にPytesseractをインストールする方法

トレースバック(最新の呼び出しの最後): ファイル "C:プロジェクト\ Visual Studioの2012 \ \ Users \ユーザーUzel \ドキュメント\ module3.py" たTesseractインポートimage_to_string はImportErrorから では、ライン28、:名前をインポートすることはできませんimage_to_string

このエラーがあります。私はpytesseractを試みましたが、私は管理できません。この問題を解決できますか?どうやって?ありがとうございました。

+0

'C:\ Users/Uzel/Desktop/pythonfoto/denklem.png'を' C:/ Users/Uzel/Desktop/pythonfoto/denklem.png'に変更します。 – thewaywewere

+0

残念ながらもう一度動作しません。私はtesseractにはimage_to_stringがないと思います。私はインストールすることができますpytesseractをインストールすることはできません。 –

+0

詳しいことはできますか?あなたはイメージパス上で変更を加え、それは一度動作しましたか? – thewaywewere

答えて

1

サンプルコードはpytesseractです。

import pytesseract 
from PIL import Image 

pytesseract.pytesseract.tesseract_cmd = "C:/Program Files/Tesseract 4.0.0/tesseract.exe" 
print(pytesseract.image_to_string(Image.open("./imagesStackoverflow/text.png"), 
            lang="eng",boxes=False,config="--psm 3 --eom 3")) 

pytesseract.pytesseract.tesseract_cmdは、特定の明示場合にはパスが正しくWindows環境で設定されていないEXEのパスです。

WindowsにはTesseractをインストールし、Pythonにはpytesseractをインストールする必要があります。

このヘルプが必要です。

+0

@Nida上記はあなたの問題を解決するのに役立ちますか? – thewaywewere

関連する問題