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安装包,直接右击安装即可,安装完 ...
随机推荐
- java架构之路-(SpringMVC篇)SpringMVC主要流程源码解析(上)源码执行流程
做过web项目的小伙伴,对于SpringMVC,Struts2都是在熟悉不过了,再就是我们比较古老的servlet,我们先来复习一下我们的servlet生命周期. servlet生命周期 1)初始化阶 ...
- NAT网络下tcp_tw_recycle参数引起的故障
记录一次阿里云服务器故障排查思路 公司网络是nat 环境 问题: 同一个服务有两台服务器 172.19.19.252 172.19.19.187 两台服务器 要连node5 发现172.19.19.2 ...
- 确认自己所用的python版本
总结: 目前有两个版本的python处于活跃状态:python2,python3 有多种流行的python运行环境:cpython(应用最广泛的python解释器,如无对解释器有要求,一般用这个,默认 ...
- POJ 3784 Running Median (模拟水过带翻译)
Description Moscow is hosting a major international conference, which is attended by n scientists fr ...
- 马蜂窝 IM 移动端架构的从 0 到 1
(马蜂窝技术原创内容,公众号 ID:mfwtech) 移动互联网技术改变了旅游的世界,这个领域过去沉重的信息分销成本被大大降低.用户与服务供应商之间.用户与用户之间的沟通路径逐渐打通,沟通的场景也在不 ...
- 单调队列与DP
算是一个总结吧! 先来一个模板: TYVJ 1305 最大子序和 题目描述 输入一个长度为n的整数序列,从中找出一段不超过M的连续子序列,使得整个序列的和最大. 例如 1,-3,5,1,-2,3 当m ...
- Mysql数据类型最细讲解
文章原创于公众号:程序猿周先森.本平台不定时更新,喜欢我的文章,欢迎关注我的微信公众号. 数据库中事务是最重要的概念之一,所以上篇着重谈了谈数据库中事务的使用,并且举了实例如何在实际开发中去使用事务进 ...
- Mac系统 安装Photoshop CC 2018破解版
应用场景 本人从事前端行业,但是工作中有时也需要会点PS技能,之前一直使用window系统,突然换了Mac其他软件基本都差不多安装完了,就剩下比较难搞的PS.刚开始按照网上乱七八槽的教程下载过好多次都 ...
- python中使用logging将日志写入文件或输出到控制台
import logging import os class Logger: def __init__(self, name=__name__): # 创建一个loggger self.__name ...
- pycharm中常见错误提示
1.类中定义函方法 PyCharm 提示Method xxx may be 'static': 原因:该方法不涉及对该类属性的操作,编译器建议声明为@staticmethod