有什么方法可以使用 pytesseract OCR 读取烤箱中的数字编号?

Is there any way to read Digital Number in the oven using pytesseract OCR?

我正在使用 tesseract OCR 做一个小项目。 我想读的是烤箱生成的数字编号。 我使用 openCV 预处理图像 但是,tesseract 无法正确读取图像。 例如。 194 为 794.. 让我知道有什么办法可以解决这个问题。 谢谢。

下面是我要看的图

import cv2
import numpy

img_color = cv2.imread('20190509_103247.jpg', cv2.IMREAD_COLOR)

dst = img_color.copy()
roi = img_color[1600:1800,600:1100]
dst[0:200,0:500]=roi
blur = cv2.GaussianBlur(roi,(5,5),0)
gray_dst = cv2.cvtColor(blur, cv2.COLOR_BGR2GRAY)
ret, thr = cv2.threshold(gray_dst, 70, 255,cv2.THRESH_BINARY)
canny = cv2.Canny(roi,100,255)
sobel = cv2.Sobel(gray_dst,cv2.CV_8U,1,0,3)
laplacian = cv2.Laplacian(gray_dst,cv2.CV_8U,ksize=3)
rev = cv2.bitwise_not(canny)

# blur = cv2.GaussianBlur(roi,(5,5),0)

# stencil = numpy.zeros(rev.shape).astype(rev.dtype)
# _, contours, _ = cv2.findContours(rev, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
# color = [255, 255, 255]
# cv2.fillPoly(stencil, contours, color)
# result = cv2.bitwise_and(rev, stencil)

cv2.namedWindow('Show Image')

cv2.imshow('Show Image', rev)

cv2.waitKey(0)

cv2.imwrite('savedimage.jpg', rev)



cv2.destroyAllWindows()

您可以创建适用于您的字体/字形的训练数据,以改进数字显示转换为正确数字的方式。

参考文献: