python图像识别--验证码
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、找到 pytesseract.py 更改 tesseract_cmd = 'C:/Program Files/Tesseract-OCR/tesseract.exe'
代码:
# !/usr/bin/python3.4
# -*- coding: utf-8 -*- import pytesseract
from PIL import Image image = Image.open('../jpg/code.png')
code = pytesseract.image_to_string(image)
print(code)






如果出现错误:
'str' does not support the buffer interface
将 `pytesseract.py` 中的下面语句更换:
lines = error_string.splitlines()
#error_lines = tuple(line for line in lines if line.find('Error') >= 0)
error_lines = tuple(line.decode('utf-8') for line in lines if line.find(b'Error') >= 0)
if len(error_lines) > 0:
return '\n'.join(error_lines)
else:
return error_string.strip()
如果要识别更多的文字,需要在安装tesseract-ocr的时候选择全部语言,也就1.3G
识别精度不是很高,要不就是现在的验证码太变态,人为也看不出来是什么
推荐机器学习验证码:http://www.cnblogs.com/beer/p/5672678.html
python图像识别--验证码的更多相关文章
- python 简单图像识别--验证码
python 简单图像识别--验证码 记录下,准备工作安装过程很是麻烦. 首先库:pytesseract,image,tesseract,PIL windows安装PIL,直接exe进行安装更方便( ...
- 实验楼Python破解验证码
本人大二,因为Python结业考试项目,又想要学习机器学习方向,但是由于接触时间不长,选择了实验楼的Python破解验证码这个项目作为我的项目, 我在原来的基础上加了一些代码用于完善,并且对功能如何实 ...
- python识别验证码——PIL,pytesser,pytesseract的安装
1.使用Python识别验证码需要安装Python的图像处理模块(PIL.pytesser.pytesseract) (安装过程需要pip,在我的Python中已经安装pip了,pip的安装就不在赘述 ...
- python之验证码识别 特征向量提取和余弦相似性比较
0.目录 1.参考2.没事画个流程图3.完整代码4.改进方向 1.参考 https://en.wikipedia.org/wiki/Cosine_similarity https://zh.wikip ...
- python中验证码连通域分割的方法详解
python中验证码连通域分割的方法详解 这篇文章主要给大家介绍了关于python中验证码连通域分割的相关资料,文中通过示例代码介绍的非常详细,对大家学习或者使用python具有一定的参考学习价值,需 ...
- 关于利用python进行验证码识别的一些想法
转载:@小五义http://www.cnblogs.com/xiaowuyi 用python加“验证码”为关键词在baidu里搜一下,可以找到很多关于验证码识别的文章.我大体看了一下,主要方法有几类: ...
- 利用Python突破验证码限制
一.实验说明 本实验将通过一个简单的例子来讲解破解验证码的原理,将学习和实践以下知识点: Python基本知识 PIL模块的使用 二.实验内容 安装 pillow(PIL)库: $ sudo apt- ...
- python 生成验证码
在工作中经常遇到一些验证码,这些是怎么生成的呢,今天我用Python编写了下 import randomcode = []for i in range(6): if i == random.randi ...
- python生成验证码脚本
最近每天都用python写一个小的脚本,练习使用python语法. 验证码的生成: 这里使用了python的图像处理库PIL,安装PIL的过程中出了一个小麻烦,就使用Pillow-win32的一个文件 ...
随机推荐
- C#_控件——DropDownList
1.html <asp:CheckBox ID="CheckBox11" runat="server" onclick="changecheck ...
- MySQL 基本函数
(1).字符串类 CHARSET(str) //返回字串字符集 CONCAT (string2 [,... ]) //连接字串 INSTR (string ,substring ) //返回subst ...
- jquery-ui 进度条
<!DOCTYPE html> <html> <head> <meta charset="utf8" /> <title> ...
- Weblogic项目部署及数据源配置
号线项目总结: weblogic项目配置: 把工作区放到磁盘上,建立weblogic域 在安装的weblogic服务器的开始项里选择 进入weblogic域的建立. 建立完域后用Myeclipse打开 ...
- 【avalon】parseData
<div data-a="true" data-b="false" data-d="5" data-e="null" ...
- 目标跟踪之Lukas-Kanade光流法
转载自:http://blog.csdn.net/u014568921/article/details/46638557 光流是图像亮度的运动信息描述.光流法计算最初是由Horn和Schunck于19 ...
- ZOJ 1240 IBM Minus One
/* You may have heard of the book '2001 - A Space Odyssey' by Arthur C. Clarke, or the film of the s ...
- bootStrap-2
全局样式: 1.移除Body的margin声明: 2.设置Body的背景色为白色: 3.为排版设置了基本的字体,字号和行高: 4.设置全局连接颜色,且当连接处于悬浮:hover状态时,才会显示下划线样 ...
- codeforces 192e
link: http://codeforces.com/contest/330/problem/E /* ID: zypz4571 LANG: C++ TASK: 192e.cpp */ #inclu ...
- ubuntu14.04 and ros indigo install kinect driver--16
摘要: 原创博客:转载请表明出处:http://www.cnblogs.com/zxouxuewei/ 今日多次测设ros indigo install kinect driver ,提示各种失败,然 ...