Python simple image recognition--verification code

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.