python pytesseract 使用说明
来源:互联网 发布:手游网络加速 编辑:程序博客网 时间:2024/05/21 06:41
1、安装
pip install pytesseract
2、使用
#!/usr/bin/python
import Image
import pytesseract
imageObject=Image.open('test.jpg')
print (imageObject)
print (pytesseract.image_to_string(imageObject))
#print (pytesseract.image_to_string(Image.open('/root/Desktop/pythoncode/test.png')))
#print (open('test.png').read())
运行,出错:
root@TestBackTrack:~/Desktop/pythoncode# python testOcr.py
<PngImagePlugin.PngImageFile image mode=P size=70x15 at 0xB73A47EC>
Traceback (most recent call last):
File "testOcr.py", line 6, in <module>
print (pytesseract.image_to_string(imageObject))
File "/usr/local/lib/python2.7/dist-packages/pytesseract/pytesseract.py", line 142, in image_to_string
config=config)
File "/usr/local/lib/python2.7/dist-packages/pytesseract/pytesseract.py", line 75, in run_tesseract
stderr=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
首先想到的是:是不是test.jpg找不到?
测试了读文件函数,没有问题
而后网搜了下,发现没有安装tesseract-ocr包
参考:http://stackoverflow.com/questions/18322933/pytesser-simple-usage-error
root@TestBackTrack:~/Desktop/pythoncode# sudo apt-get install tesseract-ocr
Reading package lists... Done
Building dependency tree
.......
再次运行,可以显示数据
- python pytesseract 使用说明
- Python pytesseract WinError 2
- mac python 配置pytesseract
- selenium python pytesseract 二值化图像
- python-pytesseract安装错误总结
- Python--pytesseract验证码识别处理实例
- Python模块pytesseract验证码识别
- python 使用pytesseract图片文字识别
- windows下配置python + pytesseract环境
- Python+OpenCV+pytesseract 识别 银行卡号
- python使用pytesseract识别验证码的方法
- 利用python pytesseract进行OCR(验证码识别)
- python 使用tesseract-ocr , pytesseract , PIL进行验证码识别
- Python使用pytesseract库识别验证码(Mac)
- python下调用pytesseract识别某网站验证码
- 使用Python机器识别库pytesseract遇到的问题
- python-识别图片-安装及配置:tesseract+pytesseract+Pillow
- pytesseract的简单验证码的识别-python
- Struts2 Validation
- 好玩的造字程序
- setsockopt中参数之SO_REUSEADDR的意义(转)
- 解决eclipse闪退的办法
- HTML5最新经典俄罗斯方块游戏插件
- python pytesseract 使用说明
- accept 返回不了对端地址
- 用户体验之道谈凡客
- 浏览器不断弹出广告ads by priceless
- 移动端head需要设置的meta属性
- 如何设置Dialog宽度为屏幕宽度
- 天气接口
- js事件的监听器的使用
- findbug 介绍、用处及能检测出的一些严重的问题