【问题标题】:Tesseract OCR produces empty resultsTesseract OCR 产生空结果
【发布时间】:2019-11-28 07:20:17
【问题描述】:

我需要从图像中提取数字(参见示例图像)。我试过pytesseract 但它不工作,它产生空结果。下面是我正在使用的代码

代码

import pytesseract
import cv2

img = cv2.imread('image_path')
digits = pytesseract.image_to_string(img)
print(digits)

示例图片

我有大量图片,如上所示。 Tesseract 没有处理其中任何一个。

【问题讨论】:

    标签: python ocr tesseract python-tesseract


    【解决方案1】:

    尝试添加配置--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'
    

    【讨论】:

    • 你是救世主
    猜你喜欢
    • 2015-03-07
    • 2019-08-02
    • 1970-01-01
    • 2016-06-02
    • 2016-11-14
    • 2018-02-22
    • 1970-01-01
    • 2015-02-24
    • 2016-05-09
    相关资源
    最近更新 更多