關於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)
識別率還挺高的,當然這也和驗證碼本身有關,因為這個驗證碼設計的比較容易識別,別用來干壞事哦
可惜CMD調用中文識別成這鳥樣了,以后再研究:

