Tesseract OCR 产生空结果
Tesseract OCR produces empty results
我需要从图像中提取数字(参见示例图像)。我试过 pytesseract
但它不起作用,它产生空结果。下面是我使用的代码
代码
import pytesseract
import cv2
img = cv2.imread('image_path')
digits = pytesseract.image_to_string(img)
print(digits)
示例图片
我有大量图片,如上所示。 Tesseract
对其中任何一个都不起作用。
尝试添加配置 --psm 7
(意思是 Treat the image as a single text line.
)
import pytesseract
import cv2
img = cv2.imread('image_path')
digits = pytesseract.image_to_string(img,config='--psm 7')
print(digits)
#'971101004900 1545'
我需要从图像中提取数字(参见示例图像)。我试过 pytesseract
但它不起作用,它产生空结果。下面是我使用的代码
代码
import pytesseract
import cv2
img = cv2.imread('image_path')
digits = pytesseract.image_to_string(img)
print(digits)
示例图片
我有大量图片,如上所示。 Tesseract
对其中任何一个都不起作用。
尝试添加配置 --psm 7
(意思是 Treat the image as a single text line.
)
import pytesseract
import cv2
img = cv2.imread('image_path')
digits = pytesseract.image_to_string(img,config='--psm 7')
print(digits)
#'971101004900 1545'