【发布时间】:2018-02-12 08:18:44
【问题描述】:
我已使用此代码从图像文件中读取文本。 Reading text from image
代码如下
from PIL import Image
from pytesseract import image_to_string
image = Image.open("image.jpg",'r')
myText = image_to_string(Image.open(open('maxresdefault.jpg')),config='-psm 10')
myText = image_to_string(Image.open(open('maxresdefault.jpg')))
print(myText)
错误:UnicodeDecodeError:'charmap'编解码器无法解码位置 278 中的字节 0x81:字符映射到
尝试通过以下方式解决此错误:UnicodeDecodeError: 'charmap' codec can't decode byte X in position Y: character maps to <undefined>
然后出现错误:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
【问题讨论】:
-
您在什么时候收到此错误?在 Image.open() 上? image_to_string() ??