Python 图片识别
来源:互联网 发布:诺基亚3310软件下载 编辑:程序博客网 时间:2024/05/08 02:14
1:安装PIL,官方没有WIN64位,Pillow替代
pip install Pillow-2.7.0-cp27-none-win_amd64.whl
2:安装Pytesser
下载pytesser_v0.0.1.zip,解压后复制进Python27\Lib\site-packges\pytesser路径下,无pytesser则新建
在Python27\Lib\site-packges\pytesser中新建一pytesser.pth文件,内容为pytesser
在pytesser内,修改三点
1:pytesser.py修改成__init.py__
修改pytesser.py
2-1:import Image 改为 from PIL import Image
2-2:tesseract_exe_name = 'tesseract' 改为tesseract_exe_name = 'Python27\\Lib\\site-packges\\pytesser\\tesseract' 注意\转义
3:安装Tesseract
下载Tesseract OCR engine:http://code.google.com/p/tesseract-ocr/ ,
下载后解压,找到tessdata文件夹,用其替换掉pytesser解压后的tessdata文件夹即可。
pip install Pillow-2.7.0-cp27-none-win_amd64.whl
2:安装Pytesser
下载pytesser_v0.0.1.zip,解压后复制进Python27\Lib\site-packges\pytesser路径下,无pytesser则新建
在Python27\Lib\site-packges\pytesser中新建一pytesser.pth文件,内容为pytesser
在pytesser内,修改三点
1:pytesser.py修改成__init.py__
修改pytesser.py
2-1:import Image 改为 from PIL import Image
2-2:tesseract_exe_name = 'tesseract' 改为tesseract_exe_name = 'Python27\\Lib\\site-packges\\pytesser\\tesseract' 注意\转义
3:安装Tesseract
下载Tesseract OCR engine:http://code.google.com/p/tesseract-ocr/ ,
下载后解压,找到tessdata文件夹,用其替换掉pytesser解压后的tessdata文件夹即可。
不过除了测试用验证码之外,其余的系统验证码的识别率很低。
附测试代码
from pytesser import *from PIL import Image, ImageEnhanceim = Image.open('D:\Python27\Lib\site-packages\pytesser\phototest.tif')im2 = Image.open(r'D:\Python27\Lib\site-packages\pytesser\fnord.tif','r')im3 = Image.open(r'F:\PROJECT\python\code\Study_1\src\20170424\cp.jpg','r') #文件读写模式以防报错#图片处理1::黑白处理enhancer = ImageEnhance.Contrast(im3)image2 = enhancer.enhance(5)image2.show()print image_to_string(image2)#图片处理2: 降噪处理imgry = im3.convert('L') #灰度处理#灰度处理基础上二值化处理threshold = 140table = []for i in range(256): if i < threshold: table.append(0) else: table.append(1)out = imgry.point(table, '1')out.show()text = image_to_string(out)if text.isspace() : print "FAILE"else: print text#print text
0 0
- python 识别无效图片
- Python 图片识别
- python图片识别小程序
- python识别图片验证码
- python之图片文本识别
- python 图片验证码识别
- python识别图片验证码
- python-OCR识别图片字符
- 【Python】Python简单的图片识别
- Python 对图片进行人脸识别
- python图片文本识别的简单实现
- Python+Opencv进行识别相似图片
- 利用python进行识别相似图片(二)
- Python+Opencv识别两张相似图片
- python pytesser 识别图片验证码
- 利用python进行识别相似图片
- python 使用pytesseract图片文字识别
- python图片文本识别的简单实现
- [openstack]proxy后devstack方式安装openstack
- Android Gradle多渠道批量打包
- ARToolkit Part 3: Locating Vertices 详解
- MyBatis学习 之 一、MyBatis简介与配置MyBatis+Spring+MySql
- 在O(1)时间删除链表结点
- Python 图片识别
- JUnit之TestCase和TestSuite详解
- Windows下Git SSH 创建Key的步骤
- 2个自定义的PHP in_array 函数,解决大量数据判断in_array的效率问题
- Lucene原理
- 关于获取当前时间出现1970年问题的解决
- Ret2libc
- 第一行代码-安卓之旅
- 集合框架-集合的嵌套遍历