MAC上Tesseract识别中文乱码问题
2018-01-12 本文已影响123人
Lazy1
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就是我们中文简体


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