【发布时间】:2020-05-09 18:10:00
【问题描述】:
我有这样的图片:
我正在尝试获取输出:“_ _ _ _ _ _ _ _ _ _ c _。”
我在 Python 3.6 中工作,并尝试为此使用 tesseract。到目前为止我得到的是以下代码:
import pytesseract
from PIL import Image
# set tesseract file path
pytesseract.pytesseract.tesseract_cmd = "C:/Program Files/Tesseract-OCR/tesseract.exe"
# configurations
config = "--psm 10 --oem 3 -c tessedit_char_whitelist=abcdefghijklmnopqrstuvwxyzßäöü0123456789_-"
image = Image.open("test2.png")
text = pytesseract.image_to_string(image, config=config)
但是,这不起作用。它只是产生“ee”作为输出。对于其他图片,它有时会识别正确的字母,但不能识别下划线。我试图将它们列入白名单,但这也不起作用。怎样才能做得更好?如有任何建议,我将不胜感激。
【问题讨论】:
标签: image tesseract python-tesseract