python图像文字识别_python图片文本识别的简单实现

http://blog.sina.com.cn/s/blog_628cc2b70101cjvp.html

Python图片文本识别使用的工具是PIL和pytesser。因为他们使用到很多的python库文件,为了避免一个个工具的安装,建议使用Anaconda.

pytesser是谷歌OCR开源项目的一个模块,在Python中导入这个模块即可将图片中的文字转换成文本。pytesser调用了tesseract。当在Python中调用pytesser模块时,pytesser又用tesseract识别图片中的文字。pytesser的使用步骤如下:

首先,安装Python2.7版本,这个版本比较稳定,建议使用这个版本。

其次,安装python opencv,请自行百度之。

然后,安装PIL工具,下载的地址是:http://www.pythonware.com/products/pil/,pytesser的使用需要PIL库的支持。from pytesser.pytesser import image_to_string

from PIL import *

import Image

import ImageEnhance

image = Image.open(r"D:\workstation\driving_licence.jpg")

#使用ImageEnhance可以增强图片的识别率

enhancer = ImageEnhance.Contrast(image)

image_enhancer = enhancer.enhance(4)

print image_to_string(image_enhancer)

Python Error in image_to_string

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值