我有一张从另一张图片上剪下来的图片,我想把这张图片作为image_to_string方法的输入:
import pytesseract
import cv2
num_plate = cv2.imread('E:\Images\car_plate222.jpeg' , cv2.IMREAD_GRAYSCALE)
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
cv2.dilate(num_plate, (15, 15), num_plate)
pytesseract.image_to_string(num_plate)
为了获得更好的性能,我使用了膨胀,但它并没有给我想要的输出(有时给我空字符串,有时给我奇怪的输出)
有人知道怎么了吗
在将图像传递给
pytesseract
之前,必须threshold
该图像。这提高了准确性。 以下是一个示例:希望这有帮助:)
相关问题 更多 >
编程相关推荐