Last active
May 15, 2018 11:50
-
-
Save nani1337/1d81c269cf15ca4924e9e0d8b1267f24 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# | |
from PIL import Image | |
import pytesseract | |
image = Image.open('2.jpg') | |
orange = pytesseract.image_to_string(image) | |
print orange | |
#Record the preparation process is very troublesome. | |
#First library: pytesseract,image,tesseract,PIL | |
#Windows installation PIL, direct exe to install more convenient (https://files.cnblogs.com/files/Oran9e/PILwin64.zip) (https://files.cnblogs.com/files/Oran9e/PILwin32.zip) | |
#Install image:pip install image | |
#Install pytesseract: pip install pytesseract | |
#Install tesseract: pip install tesseract (install tesseracr, here is a pit, you need to install to the C drive C: \ Program Files (x86) \ Tesseract-OCR, which is the default path, otherwise you can not call tesseract.exe when running python code) | |
#Modify the tesseract.py code: \python\Lib\site-packages\pytesseract\tesseract.py | |
#Tesseract_cmd changed to the tesseract.exe path and called. | |
tesseract_cmd = 'C:/Program Files (x86)/Tesseract-OCR/tesseract.exe' | |
#After preparing the above work, basically a simple verification code can be identified. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment