【问题标题】:Pytesseract cannot read simple numberPytesseract 无法读取简单数字
【发布时间】:2020-10-23 14:47:01
【问题描述】:

我正在尝试使用 pytesseract 从图像中识别两个数字。 由此 1

我将图像处理成这样 2 并把它交给 pytesseract,这样就很容易了。

但是当我想通过 tesseract 阅读时 3 对此 4 它不起作用并返回空字符串

代码:

import cv2
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'


img = cv2.imread('grabbed.png')

rows, cols, channels = img.shape

imggray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
ret, img = cv2.threshold(imggray, 220, 255, cv2.THRESH_BINARY_INV)
img = cv2.resize(img,(0,0),fx=3,fy=3)
img = cv2.GaussianBlur(img,(11,11),0)
img = cv2.medianBlur(img,9)
k = pytesseract.image_to_string(img, lang='eng', config='outputbase digits --dpi 300 --psm 13')
print(k)
cv2.imshow('image', img)
cv2.waitKey(0)
cv2.destroyAllWindows()

【问题讨论】:

    标签: python image-processing cv2 python-tesseract


    【解决方案1】:

    1 - 检查方向。 pytessaract 需要完美的肖像图像。 2 - 使用拨号和错误 3 https://nanonets.com/blog/ocr-with-tesseract/ [看这个例子][1]

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-01
      • 2021-04-14
      • 1970-01-01
      • 1970-01-01
      • 2020-11-07
      • 2022-08-21
      • 2020-10-28
      • 1970-01-01
      相关资源
      最近更新 更多