【问题标题】:why tesseract can't recognize the english words on this image?为什么 tesseract 无法识别这张图片上的英文单词?
【发布时间】:2020-12-25 03:31:34
【问题描述】:

我正在使用 tesseract 4.0 识别 english 单词,但在此图像上失败,没有识别任何单词,

任何人都可以给小费,谢谢

    r=pytesseract.image_to_string('6.jpg', lang='eng')
    print(r)

Fail image

更新:

我尝试使用在线网站进行 OCR

https://www.newocr.com/

它有效,但为什么呢?

如何使用 tesseract 识别它?

【问题讨论】:

    标签: tesseract python-tesseract


    【解决方案1】:

    问题是pytesseract 不是旋转不变的。因此,您需要进行额外的预处理。 source

    • 我的第一个想法是把图片旋转一个小角度

    • img = imutils.rotate_bound(cv2.imread("YD90o.png"), 4)
      
    • 结果:

    • 现在如果我申请adaptive-threshold

    • 要使用pytesseract 阅读,您需要设置额外的配置:

      • pytesseract.image_to_string(thr, lang="eng", config="--psm 6")
        
      • PSM (page-segmentation-mode) 6 假设一个统一的文本块。 source

    • 结果:

      • 你想得到图片的最后一句话。

      • txt = pytesseract.image_to_string(thr, lang="eng", config="--psm 6")
        txt = txt.replace('\f', '').split('\n')
        print(txt[len(txt)-2])
        
      • 结果:

      • Continue Setub ie Gene
        

    网站可能会使用深度学习方法来检测图像中的单词。但是当我使用 newocr.com 时,结果是:

    oy Eee a
    setuP me -
    continve ae
    

    【讨论】:

    • Ahx,非常感谢您的帮助,我会根据您的建议尝试一下
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-12-04
    • 1970-01-01
    • 2013-06-14
    • 1970-01-01
    • 1970-01-01
    • 2021-09-10
    • 2021-09-29
    相关资源
    最近更新 更多