代码之家  ›  专栏  ›  技术社区  ›  aleroot

从带有背景图像的浅色文本中提取文本

  •  0
  • aleroot  · 技术社区  · 7 年前

    Image to be processed

    ws35 ,我试过 玻璃陶瓷 使用方法的库:

    pytesseract.image_to_string(Image.open(path))
    

    但它什么也没有。。。我做错什么了吗?如何使用OCR找回文本?我需要在上面加些过滤器吗?

    4 回复  |  直到 7 年前
        1
  •  1
  •   Yves Daoust    7 年前

    类似于@SilverMonkey的建议:高斯模糊之后是Otsu阈值。

    enter image description here

        2
  •  5
  •   SilverMonkey    7 年前

    您可以尝试以下方法:

    • Binarize 使用您选择的方法生成图像(在这种情况下,使用127作为阈值就足够了)
    • minimum filter 将丢失的点连接起来形成字符。因此,r=4的过滤器似乎工作得很好: Image after application of minimum filter
    • 如有必要,可通过应用 median blur (r=4): enter image description here

        3
  •  0
  •   Stanley    7 年前

    问题是这张照片质量不好,而且噪音很大! 甚至专业和企业项目也在努力解决这个问题

    简短的回答是:pytesseract无法读取此图像中的文本,而且很可能没有模块或专业程序可以读取它。

        4
  •  0
  •   user70    7 年前
    推荐文章