码迷,mamicode.com
首页 > 编程语言 > 详细

在Mac上 python中使用tesseract OCR (Pytesser) 识别图片中的文字

时间:2018-01-06 19:02:02      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:app   -o   style   使用   print   int   gpo   sha   bin   

仓库地址:https://github.com/RobinDavid/Pytesser

brew install tesseract

sudo pip install opencv-python

安装好之后需要下载识别文件,由于我的环境是

tesseract 3.02.02

 leptonica-1.70

  zlib 1.2.11

 

所以我下载了3.02的中文识别训练数据,地址是 

https://sourceforge.net/projects/tesseract-ocr-alt/files/

 

需要解压到

/usr/local/share/tessdata

 

之后编写脚本test.py

import pytesser

txt = pytesser.image_file_to_string("./test.png","chi_sim")
print(txt)

运行python test.py

 

到这里已经可以简单的识别出文字了

文禾斗

i吾文

儡尔立占在止匕士也不要走云力, 我去买几斤橘
子回来这个梗出自i佳的文章

但是明显识别率还不高,需要我们来优化配置,或者自己训练一个数据。

 

 

在Mac上 python中使用tesseract OCR (Pytesser) 识别图片中的文字

标签:app   -o   style   使用   print   int   gpo   sha   bin   

原文地址:https://www.cnblogs.com/xirtam/p/8214842.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!