V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
woshichuanqilz
V2EX  ›  Python

tesseract 的数字识别的问题

  •  
  •   woshichuanqilz · 2019-02-02 23:33:24 +08:00 · 5167 次点击
    这是一个创建于 1907 天前的主题,其中的信息可能已经有所发展或是发生改变。

    用的 python

    这张图片识别成了 BS... img

    识别信息:

    Tesseract Open Source OCR Engine v4.0.0.20181030 with Leptonica Warning: Invalid resolution 0 dpi. Using 70 instead. BS

    版本:

    $ D:\Tesseract-OCR\tesseract.exe -v tesseract v4.0.0.20181030 leptonica-1.76.0 libgif 5.1.4 : libjpeg 8d (libjpeg-turbo 1.5.3) : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11 : libwebp 0.6.1 : libopenjp2 2.2.0

    我已经尝试了, 把转换为 tiff 格式, 用 OpenCV 的 threshold 和 erosion 处理都不行, 我想 tesseract 的识别能力不至于这么差吧。。。 这个图片我觉得已经很简单了。

    有那个老哥有相关的经验, 或者有什么其他的方法, 在线的 ocr 速度不行我这个最好还是本地的 OCR 比较好。 主要识别数字, 今天刚下载的 tesseract...

    7 条回复    2019-02-03 10:07:16 +08:00
    diggerdu
        1
    diggerdu  
       2019-02-02 23:49:56 +08:00 via iPhone
    不用 lstm 呢
    realpg
        2
    realpg  
       2019-02-02 23:52:47 +08:00
    这个图片你觉得很简单了

    你到现在还没理解最基本的计算机和人的区别……
    alvin666
        3
    alvin666  
       2019-02-02 23:57:29 +08:00 via Android
    炼丹吧少年
    cjq8z
        4
    cjq8z  
       2019-02-03 00:04:17 +08:00 via Android
    用下面语句,tesseract myimage.png stdout -c tessedit_char_whitelist=0123456789
    whstarlit
        5
    whstarlit  
       2019-02-03 08:04:22 +08:00
    tesseract 配置里改成只识别 0-9 数字,然后识别用 -psm 10
    laqow
        6
    laqow  
       2019-02-03 09:34:24 +08:00 via Android
    没下载好一点的训练文件,没指定 psm
    nicevar
        7
    nicevar  
       2019-02-03 10:07:16 +08:00
    很明显你没配置好
    pytesseract.image_to_string(image, config='./tessdata')
    指定好 testdata 目录就行了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3498 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 10:56 · PVG 18:56 · LAX 03:56 · JFK 06:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.