【发布时间】:2021-11-08 04:01:44
【问题描述】:
我试图分析一张图片,但 tesseract 似乎无法区分数字 7 和数字 1。
当前配置:
pytesseract.image_to_string(thresh, lang='eng', config='--psm 7 --oem 1 -c tessedit_char_whitelist=0123456789')
【问题讨论】:
标签: python tesseract python-tesseract
我试图分析一张图片,但 tesseract 似乎无法区分数字 7 和数字 1。
当前配置:
pytesseract.image_to_string(thresh, lang='eng', config='--psm 7 --oem 1 -c tessedit_char_whitelist=0123456789')
【问题讨论】:
标签: python tesseract python-tesseract
尝试以下方法:
import pytesseract
from PIL import Image
import requests
import io
response = requests.get('https://i.stack.imgur.com/lrNIR.png')
text = pytesseract.image_to_string(Image.open(io.BytesIO(response.content)), lang='eng',
config='--psm 13 --oem 3 -c tessedit_char_whitelist=0123456789')
print(text)
输出:
776
您也可以使用tesseract 命令将结果打印到标准输出:
tesseract input.png stdout -l eng --psm 13 --oem 3
【讨论】:
tesseract 4.1.1