【问题标题】:How can I properly detect LetsGoDigital font text?如何正确检测 LetsGoDigital 字体文本?
【发布时间】:2021-04-27 12:51:20
【问题描述】:

我在 Windows 10 上,我尝试从这张图片中提取数字

使用语言为letspytesseract 库(参见https://github.com/adrianlazaro8/Tesseract_sevenSegmentsLetsGoDigital 或LetsGoDigital,参见https://github.com/arturaugusto/display_ocr)。

我预处理了我的图像(灰色、阈值和侵蚀)以获得:

但是输出

pytesseract.image_to_string(img, lang='lets')

是空的。

【问题讨论】:

    标签: python python-tesseract


    【解决方案1】:

    您没有设置任何特定的page segmentation method。我会在这里选择--psm 6

    假设一个统一的文本块。

    所以,即使没有进一步的预处理,我也会得到正确的结果:

    import cv2
    import pytesseract
    
    img = cv2.imread('RcVbM.jpg')
    
    text = pytesseract.image_to_string(img, lang='lets', config='--psm 6')
    print(text.replace('\n', '').replace('\f', ''))
    # 004200
    
    ----------------------------------------
    System information
    ----------------------------------------
    Platform:      Windows-10-10.0.19041-SP0
    Python:        3.9.1
    PyCharm:       2021.1.1
    OpenCV:        4.5.2
    pytesseract:   5.0.0-alpha.20201127
    ----------------------------------------
    

    【讨论】:

      猜你喜欢
      • 2017-06-04
      • 1970-01-01
      • 2017-09-12
      • 2021-11-29
      • 1970-01-01
      • 2012-04-24
      • 2020-03-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多