【发布时间】:2015-09-25 22:30:25
【问题描述】:
我正在尝试开始使用 pytesseract,但正如您在下面看到的那样,我遇到了问题。
我发现人们遇到了似乎相同的错误,他们说这是 PIL 1.1.7 中的错误。其他人说问题是由 PIL 懒惰引起的,需要强制 PIL 在打开图像后使用im.load() 加载图像,但这似乎没有帮助。任何建议都非常感谢。
K:\Glamdring\Projects\Images\OCR>python
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
>>> import pytesseract
>>> pytesseract.image_to_string(Image.open('foo.png'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build\bdist.win32\egg\pytesseract\pytesseract.py", line 143, in image_to_string
File "c:\Python27_32\lib\site-packages\PIL\Image.py", line 1497, in split
if self.im.bands == 1:
AttributeError: 'NoneType' object has no attribute 'bands'
【问题讨论】:
-
你能发布导致这个问题的图片吗?
标签: python-2.7 python-imaging-library ocr