【发布时间】:2022-01-10 23:34:35
【问题描述】:
我正在尝试从 .png 文件中读取文本,但无法获得正确的输出。
这是我尝试过的代码:
from PIL import Image
from pytesseract import pytesseract
path_to_tesseract = r"Path_to Tesseract-OCR.exe"
image_path = r"Path to png file"
img = Image.open(image_path)
pytesseract.tesseract_cmd = path_to_tesseract
text = pytesseract.image_to_string(img)
print(text)
我得到的输出是这样的:m _ an I: umonfé ‘
输入.png文件:
预期的输出是LG485169046
【问题讨论】:
标签: python-3.x image-processing ocr python-tesseract