请在尝试识别之前调用SetImage。pytesser返回0错误。

4
我将尝试将文本图像转换为文本。 我正在使用Python中的pytesser进行此操作,我已经安装了tesseract,但是运行以下代码时出现问题:
from pytesser import *
im = Image.open('phototest.tif')
text = image_to_string(im)
print text

I get the following error:

Tesseract Open Source OCR Engine with Leptonica
Please call SetImage before attempting recognition.

什么都没有被打印出来,也没有任何结果。对上述问题有任何帮助吗?

2个回答

4
尝试将您的图像转换为其他格式,看看是否有相同的问题。我在使用命令行中的Tesseract时遇到了同样的问题。我有一个bmp文件,在预处理中将文件保存为png,然后tesseract正常工作。

0
作为替代方案,您可以使用 pytesseract,它将自动转换您的图像并正确处理它。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接