嗨,我希望通过 pytesseract 提高我在数字识别方面的表现。
我将原始图像分成如下所示的部分:

大小可以变化。
为此,我应用了一些像这样的预处理方法
image = cv2.imread(im, cv2.IMREAD_GRAYSCALE)
image = cv2.GaussianBlur(image, (1, 1), 0)
kernel = np.ones((5, 5), np.uint8)
result_img = cv2.blur(img, (2, 2), 0)
result_img = cv2.dilate(result_img, kernel, iterations=1)
result_img = cv2.erode(result_img, kernel, iterations=1)
Run Code Online (Sandbox Code Playgroud)
我明白了

然后我将其传递给 pytesseract:
num = pytesseract.image_to_string(result_img, lang='eng',
config='--psm 10 --oem 3 -c tessedit_char_whitelist=0123456789')
Run Code Online (Sandbox Code Playgroud)
然而,这对我来说还不够好,而且经常弄错数字。
我正在寻找改进的方法,我试图保持这种最小化和自给自足,但如果我不清楚,请告诉我,我会详细说明。
谢谢你。