【发布时间】:2019-09-05 01:37:51
【问题描述】:
Pytesseract 无法识别数字 6 和 8。它识别
-
6和5和 -
5为5, -
3和8和 -
8为8, -
Oct为0c:或0::和 -
Wed为Men。
使用的脚本:
config= "-c tessedit_char_whitelist=01234567890.:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -psm 3 -oem 0"
text = pytesseract.image_to_string(image, config=config)
也尝试使用 1-12 中的不同 psm 编号,但没有运气。增加对比度会导致更多数字无法识别:
kernel = np.ones((2,2),np.uint8)
dilation = cv2.dilate(im, kernel)#,iterations = 1)
text = pytesseract.image_to_string(dilation, config=config)
原始数据:
运行脚本后:
运行新脚本后:
【问题讨论】:
-
不,调整图像大小。使用
cv.resize。检查你的大写字母有多少像素高,然后计算要缩放多少图像以使它们大约 50 像素高。
标签: python opencv image-processing ocr python-tesseract