Python simple image recognition--verification code
Recording, the preparation of the installation process is very troublesome.
First Library: Pytesseract,image,tesseract,PIL
Windows installation PIL, direct EXE for easy installation (Https://files.cnblogs.com/files/Oran9e/PILwin64.zip) (https://files.cnblogs.com/files /oran9e/pilwin32.zip)
Installing IMAGE:PIP Install Image
Installing PYTESSERACT:PIP Install Pytesseract
Installation Tesseract:pip Install tesseract (Install TESSERACR, here is a pit, need to install to the C disk C:\Program Files (x86) \TESSERACT-OCR, is also the default path, otherwise run Python code is not called Tesseract.exe)
Modify tesseract.py Code: \python\lib\site-packages\pytesseract\tesseract.py
The tesseract_cmd is changed to the path of the Tesseract.exe, which is called.
Tesseract_cmd = ' C:/Program Files (x86)/tesseract-ocr/tesseract.exe '
To get the job done, you can basically identify a simple captcha.
Code:
#coding =utf-8from PIL Import imageimport pytesseractimage = Image.open (' 2.jpg ') orange = pytesseract.image_to_string ( image) Print Orange
The next article will write an automatic identification code, the implementation of automatic landing of the small script.
Let the weight of the road be far!
Python simple image recognition--verification code