ddddocr识别OCR自动库
海宝7号 人气:0需要ocr识别,推荐一个Python免费的验证码识别-ddddocr
安装过程:
1、镜像安装:pip install ddddocr -i http://pypi.tuna.tsinghua.edu.cn/simple
pip install ddddocr -i http://pypi.tuna.tsinghua.edu.cn/simple
2.python.exe -m pip install --upgrade pip
注意升级pip库,,动不动升级就很麻烦。
Collecting pip Downloading http://pypi.tuna.tsinghua.edu.cn/packages/ca/31/b88ef447d595963c01060998cb329251648acf4a067721b0452c45527eb8/pip-21.2.4-py3-none-any.whl (1.6 MB) |████████████████████████████████| 1.6 MB 939 kB/s Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 21.2.1 Uninstalling pip-21.2.1: Successfully uninstalled pip-21.2.1 Successfully installed pip-21.2.4
完成之后,找个参考图片
import ddddocr ocr = ddddocr.DdddOcr() with open('1.png', 'rb') as f: img_bytes = f.read() res = ocr.classification(img_bytes) print(res)
对比效果图:
效果不是太好,有的图片,例如:
哈哈哈,自个玩吧。
附ddddocr-验证码识别案例
import ddddocr ocr=ddddocr.DdddOcr() with open('test_img.png', 'rb') as f: img_bytes=f.read() res=ocr.classification(img_bytes) print(res)
普通干扰较弱的验证码均可识别通过
总结
加载全部内容