Python 验证码识别(别干坏事哦...)
时间:2015-11-11 11:41:36
收藏:0
阅读:374
关于python验证码识别库,网上主要介绍的为pytesser及pytesseract,其实pytesser的安装有一点点麻烦,所以这里我不考虑,直接使用后一种库。
一、python验证码识别库安装
要安装pytesseract库,必须先安装其依赖的PIL及tesseract-ocr,其中PIL为图像处理库,而后面的tesseract-ocr则为google的ocr识别引擎。
1、Pillow 下载地址:[见导航栏]
3.4中只能使用pillow,使用方法基本和PIL没有什么区别。
2、tesseract-ocr下载地址:[见导航栏]
这货在安装过程中比较慢,耐心一点。
3、pytesseract安装[见导航栏]
直接使用pip install pytesseract安装即可,或者使用easy_install pytesseract
二、Python验证码识别代码:[太简单了]
import pytesseract from PIL import Image image = Image.open(‘vcode.png‘) vcode = pytesseract.image_to_string(image) print (vcode)
识别率还挺高的,当然这也和验证码本身有关,因为这个验证码设计的比较容易识别,别用来干坏事哦
原文:http://www.cnblogs.com/yeayee/p/4955506.html
评论(0)