Python识别验证码
也是出于喜欢,最近开始了研究机器学习方面的东西,还未入行,只是根据教程自己做了下怎么识别验证码.用的是google的OCR开源库tesseract-ocr.使用python来实现的.我来写下我实验的过程.
环境准备
- *Unix
- Python
- pytesseract
- tesseract-ocr
- pillow
- Ipython(非必须)
环境安装
first step
1 | git clone [email protected]:madmaze/pytesseract.git |
此时如果使用pytesseract.image_to_string,会抛出OSError: [Errno 2] No such file or directory error,详情看https://github.com/madmaze/pytesseract/issues/13
这是因为没有安装tesseract-ocr
1 | # ubuntu |
OK
fuck checkCode
1 | # 图片预先处理,去噪 |
OK
后续
之后我会去研究更高级的一些识别方式.这种方法识别率还是很低的.