【发布时间】:2017-11-19 16:02:28
【问题描述】:
我目前面临 pytesseract 的问题,该软件无法检测到此图像中的数字:
https://i.stack.imgur.com/kmH2R.png
这是从应用了阈值过滤器的较大图像中获取的。
出于某种原因,pytesseract 不想识别此图像中的 6。有什么建议?这是我的代码:
image = #Insert raw image here. My code takes a screenshot.
image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
image = cv2.medianBlur(image, 3)
rel, gray = cv2.threshold(image, 127, 255, cv2.THRESH_BINARY)
# If you want to use the image from above, start here.
image = Image.fromarray(image)
string = pytesseract.image_to_string(image)
print(string)
编辑:通过进一步调查,我的代码在包含 2 位数字的情况下运行良好。但不是那些有单数的。
【问题讨论】:
标签: python opencv python-tesseract