美文网首页AndroidAndroid开发Android开发经验谈
MAC上Tesseract识别中文乱码问题

MAC上Tesseract识别中文乱码问题

作者: Lazy1 | 来源:发表于2018-01-12 13:15 被阅读123次

1.使用此庫封装好的https://github.com/madmaze/pytesseract
2.下载中文语音库到/usr/local/Cellar/tesseract/3.04.01_2/share/tessdata/目录下面

3.下载语言包https://github.com/tesseract-ocr/tessdata

# -*- coding: utf-8 -*-

try:
   import Image
except ImportError:
   from PIL import Image
import pytesseract

tex = pytesseract.image_to_string(Image.open('WX20180111-152648@2x.png'), lang='chi_sim')
print(tex);

chi_sim就是我们中文简体


image.png image.png

注意引入pytesseract依赖,需要单独下载tessdata识别包
MAC上执行 brew install tesseract 此命令即可

相关文章

网友评论

    本文标题:MAC上Tesseract识别中文乱码问题

    本文链接:https://www.haomeiwen.com/subject/xotfoxtx.html