【发布时间】:2014-07-24 15:43:53
【问题描述】:
我正在使用 pytesser 对小图像进行 OCR 并从中获取字符串:
image= Image.open(ImagePath)
text = image_to_string(image)
print text
但是,pytesser 有时喜欢识别并返回非 ascii 字符。当我现在想打印我刚刚识别的内容时,就会出现问题。在 python 2.7(这是我正在使用的)中,程序崩溃了。
有什么方法可以让 pytesser 不返回任何非 ascii 字符?也许您可以在 tesseract OCR 中更改某些内容?
或者,有什么方法可以测试一个字符串的非 ascii 字符(不会导致程序崩溃),然后不打印该行?
有些人会建议使用 python 3.4,但根据我的研究,pytesser 似乎无法使用它:Pytesser in Python 3.4: name 'image_to_string' is not defined?
【问题讨论】:
标签: python image-processing ocr tesseract python-tesseract