python pytesseract使用
正确使用方法
1.tesseract-orc安装
tesseract-ocr-setup-3.05.00dev.exe下载
2.pytesseract
pip install pytesseract
3.设置 tesseract-orc路径
- 将
C:\Program Files (x86)\Tesseract-OCR添加到系统路径(路径因安装过程而异) - 修改pytesseract.py文件
tesseract_cmd = "C:/Program Files (x86)/Tesseract-OCR/tesseract.exe" - 设置环境变量 TESSDATA_PREFIX
C:\Program Files (x86)\Tesseract-OCR\tessdata
#coding = utf -8
from PIL import Image
import pytesseract
im = Image.open("2.png")
text = pytesseract.image_to_string((im), lang='chi_sim')
print (text)
try:
import Image
except ImportError:
from PIL import Image
import pytesseract
#如果PATH中没有tesseract可执行文件,请包含以下内容:
pytesseract.pytesseract.tesseract_cmd = r'<full_path_to_your_tesseract_executable>'
#示例tesseract_cmd = r'C:\ Program Files(x86)\ Tesseract-OCR \ tesseract'
#简单的图像串
print(pytesseract.image_to_string(Image.open('test.png')))
#法语文本图像串
print(pytesseract.image_to_string(Image.open('test-european.jpg'), lang='fra'))
#获取包围盒估计
print(pytesseract.image_to_boxes(Image.open('test.png')))
#获取详细的数据,包括盒,置信线和页码
print(pytesseract.image_to_data(Image.open('test.png')))
#获取有关方向和脚本检测信息
print(pytesseract.image_to_osd(Image.open('test.png'))
#为了绕过内部图像的转换,只需用相对或绝对图像路径
#注:如果你不使用支持的图像,正方体将返回错误
print(pytesseract.image_to_string('test.png'))
python pytesseract使用的更多相关文章
- Python - pytesseract 机器视觉
机器视觉 - tesseract ( 验证码 ) 安装 Ubuntu sudo apt-get install tesseract-ocr Windows 下载安装包 添加环境变量(Path) :搜 ...
- python pytesseract——3步识别验证码的识别入门
验证码识别是个大工程,但入门开始只要3步.需要用到的库PIL.pytesserac,没有的话pip安装.还有一个是tesseract-ocr 下载地址:https://sourceforge.net/ ...
- python下调用pytesseract识别某网站验证码
一.pytesseract介绍 1.pytesseract说明 pytesseract最新版本0.1.6,网址:https://pypi.python.org/pypi/pytesseract Pyt ...
- Tesseract-ocr视觉学习-验证码识别及python import pytesseract使用
Tesseract-OCR的简单使用与训练 最近看到某个网站提交数据要提交验证码,用tesseract自带的识别, 识别出来是什么鬼,0-9识别成了什么玩意! so决定自己训练下tesseract.. ...
- text recognizer (OCR) Engine 光学字符识别
https://github.com/tesseract-ocr/tesseract/wiki https://github.com/UB-Mannheim/tesseract/wiki C:\Use ...
- tesseract 安装及使用
安装软件 tesseract下载地址:https://digi.bib.uni-mannheim.de/tesseract/ 安装即可! 安装完成tesseract-ocr后,需要做一下配置 . 在P ...
- python--通过ocr对数据可视化视频还原为csv,进行简单的分析
见github https://github.com/TouwaErioH/Machine-Learning/tree/master/video/video 题目描述: source https:// ...
- python识别验证码——PIL,pytesser,pytesseract的安装
1.使用Python识别验证码需要安装Python的图像处理模块(PIL.pytesser.pytesseract) (安装过程需要pip,在我的Python中已经安装pip了,pip的安装就不在赘述 ...
- 使用python内置库pytesseract实现图片验证码的识别
环境准备: 1.安装Tesseract模块 git文档地址:https://digi.bib.uni-mannheim.de/tesseract/ 下载后就是一个exe安装包,直接右击安装即可,安装完 ...
随机推荐
- malformed header from script. Bad header的解决方法
今天配了CGI服务器,打开CGI报错: [Wed Jun 02 13:57:21 2010] [error] [client 192.168.0.1] malformed header from sc ...
- ELK 学习笔记之 Logstash之inputs配置
Logstash之inputs配置: input plugin doc: https://www.elastic.co/guide/en/logstash/current/index.html 插件很 ...
- TCP/UDP的小事情
UDP: 没有复杂的控制机制,面向无连接的通信服务. 常用于: 包总量少的通信 音视频传输(即时通信) TCP: 对传输.发送.通信.进行控制的协议.面向有连接的协议,只有在确认通信对端存在时才会发送 ...
- zend studio 13.6 导入项目及其他设置
1. 先创建一个新的项目:file -> new -> project 2. 创建新项目之后,在左侧的项目目录上右键 -> import 到此导入项目, 完成! 设置编码utf-8 ...
- 问题TypeError: __init__() takes 1 positional argument but 2 were given解决方案
在搭建自动化框架时,遇到一个问题,如下图: 根据报错的意思,应该是__init__函数的问题, 位置应该是HomePage文件 立马去查看一下文件,如图: 原来是因为的粗心大意__init__(sel ...
- MongoDB系列(一):初步理解
一.简介 MongoDB是一款强大.灵活.且易于扩展的通用型数据库 1.易用性 1)MongoDB是一款面向文档的数据库,而不是关系型数据库,因此而有着更好的扩展性. 2)通过在文档中嵌入文档和数组, ...
- Cocos2d-x入门之旅[2]精灵
精灵就是cocos是屏幕上移动的对象,能被我们控制,比如我们HelloWorld场景的这个图片就是精灵(Sprite) 怎么才算精灵?你能控制它的,就是一个精灵,否则就只是一个节点(Node) 准确的 ...
- 快速入门Maven(三)
一.整合ssh框架的Maven项目 1.传递依赖 只添加了一个struts2-core依赖,发现项目中出现了很多jar, 这种情况叫 依赖传递 2.依赖版本冲突的解决 (1)第一声明优先原则(就是谁写 ...
- django自关联,auth模块
一.自关联 写蛮好的一篇博客:https://www.cnblogs.com/Kingfan1993/p/9936541.html 1.一对多关联 1.表内自关联是指表内数据相关联的对象和表是相同字段 ...
- Android Studio 1.5运行问题
Error:Unable to start the daemon process: could not reserve enough space for object heap.Please assi ...