python pytesseract——3步识别验证码的识别入门


验证码识别是个大工程,但入门开始只要3步。需要用到的库PIL、pytesserac,没有的话pip安装。还有一个是tesseract-ocr 下载地址:https://sourceforge.net/projects/tesseract-ocr-alt/files/。

哪3步?

 

1、安装库

pip install Pillow
pip install pytesseract

 

2、安装tesseract-ocr

默认安装,主要是新添加个环境变量。如下图

 

3、编写代码

import pytesseract 
from PIL import Image
print pytesseract.image_to_string(Image.open("D:\\Desktop\\1.png"),lang="eng",config="-psm 7")

 

举个例子,上图的识别

 

 

bingo,7572!

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM