六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 845|回复: 0

python图像识别--验证码

[复制链接]
 楼主| 发表于 2017-8-9 11:47:53 | 显示全部楼层 |阅读模式
python图像识别--验证码
1、pip3 install pyocr
2、pip3 install pillow or easy_install Pillow
4、要求python默认安装在C盘
5、找到 pytesseract.py 更改 tesseract_cmd = 'C:/Program Files/Tesseract-OCR/tesseract.exe'
代码:
  1. <blockquote># !/usr/bin/python3.4
复制代码





如果出现错误:
  1. 'str' does not support the buffer interface
复制代码
将 `pytesseract.py` 中的下面语句更换:
  1. lines = error_string.splitlines()
  2. #error_lines = tuple(line for line in lines if line.find('Error') >= 0)
  3. error_lines = tuple(line.decode('utf-8') for line in lines if line.find(b'Error') >= 0)
  4. if len(error_lines) > 0:
  5.     return '\n'.join(error_lines)
  6. else:
  7.     return error_string.strip()
复制代码
如果要识别更多的文字,需要在安装tesseract-ocr的时候选择全部语言,也就1.3G
识别精度不是很高,要不就是现在的验证码太变态,人为也看不出来是什么
推荐机器学习验证码:http://www.cnblogs.com/beer/p/5672678.html
python图像识别--验证码
摘自:http://www.cnblogs.com/TTyb/p/5996847.html
该会员没有填写今日想说内容.
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表