学习python图像识别

参考:http://www.cnblogs.com/TTyb/p/5996847.html

 

1、pip3 install pyocr

2、pip3 install pillow or easy_install Pillow

3、安装tesseract-ocr:http://jaist.dl.sourceforge.net/project/tesseract-ocr-alt/tesseract-ocr-setup-3.02.02.exe,安装在C:\Program Files\下

4、要求python默认安装在C盘

5、找到 tesseract.py 更改 tesseract_cmd = 'C:/Program Files/Tesseract-OCR/tesseract.exe'

 

# -*- coding: utf-8 -*-

from pyocr import tesseract
from PIL import Image

image = Image.open('test.png')
code = tesseract.image_to_string(image)
print(code)

 

测试结果如下:

 

识别为:  111111

 

posted on 2017-06-09 16:14  michael_YM  阅读(227)  评论(0编辑  收藏  举报

导航