Python--文字识别--Tesseract
2017-11-29 16:31
513 查看
1.介绍
Tesseract 是一个 OCR 库,目前由 Google 赞助(Google 也是一家以 OCR 和机器学习技术闻名于世的公司)。Tesseract 是目前公认最优秀、最精确的开源 OCR 系统。 除了极高的精确度,Tesseract 也具有很高的灵活性。它可以通过训练识别出任何字体,也可以识别出任何 Unicode 字符。2.安装
以下所有都是在mac上安装实现的//安装tesseract的同时安装训练工具 brew install --with-training-tools tesseract //安装tesseract的同时安装所有语言,语言包比较大,如果安装的话时间较长,建议不安装,按需选择 brew install --all-languages tesseract //安装tesseract,并安装训练工具和语言 brew install --all-languages --with-training-tools tesseract //只安装tesseract,不安装训练工具 brew install tesseract
3.下载语言库
下载地址:https://github.com/tesseract-ocr/tessdata默认自带的是英语
根据自己的需求选择所要的语言库,在这里我们选择的是简体中文所以选择的库是:chi_sim.traineddata
将文件拷贝到到:/usr/local/Cellar/tesseract/(你下载的版本号)/share/tessdata目录下。
4.Tesseract的命令行使用
一般使用://默认使用eng文字库, imgName是图片的地址,result识别结果 tesseract imgName result
指定语言:
//指定使用简体中文 tesseract -l chi_sim imgName result //查看本地存在的语言库 tesseract --list-langs
指定多语言:
//指定多语言,用+号相连 tesseract -l chi_sim+eng imgName result
5.Tesseract在Python中使用
通过 pip 安装支持Python 版本的 Tesseract库pip install pytesseract
通过Python代码的简单实现
import pytesseract from PIL import Image image = Image.open('/Users/admin/Desktop/test.jpg') text = pytesseract.image_to_string(image) print text
是爬虫中的验证码的识别,可以通过更换别人训练好的语言包来识别.如果想自己通过训练来获得语言包也是可以的.
6.Tesseract训练
这里放个官方文档,等我练好了再分享https://github.com/tesseract-ocr/tesseract/wiki
相关文章推荐
- Python(应用) — Tesseract图片文字识别(一)
- Python_文字识别引擎试用:tesseract-ocr
- python + tesseract OCR 文字识别
- Java中使用tess4J(Tesseract-OCR)进行图片文字识别(支持中文)
- python图片文字识别笔记
- Python图像处理之图片文字识别(OCR)
- python图像上面字符的识别之tesseract—OCR和中文包的下载使用
- Python 利用pytesser模块识别图像文字
- 在Mac上 python中使用tesseract OCR (Pytesser) 识别图片中的文字
- python-识别图片-安装及配置:tesseract+pytesseract+Pillow
- Python+Selenium+PIL+Tesseract真正自动识别验证码进行一键登录
- 使用Tesseract-OCR训练文字识别记录
- Tesseract 文字识别 运用于ios7 xcode5 任意工程
- 制作大漠字库并用python调用大漠工具方法来识别文字
- python 3调用百度OCR API实现剪贴板文字识别
- OpenCV+Tesseract进行OCR学习(二)文字识别
- Android文字识别之tesseract的使用
- python脚本实现《百万英雄》文字识别 自动搜索
- 如何使用tesseract-ocr4.0识别图片文字
- CENTOS 下 编译安装 tesseract-ocr 3.0.4 识别文字