安装方法:pip install pytesseract
1.windows上要安装tesseract-ocr-setup-4.00.00dev.exe程序,然后设置环境变量
这里有视频教程:https://www.bilibili.com/video/av20354957
2.innux上要安装tesseract-ocr库,
sudo add-apt-repository ppa:alex-p/tesseract-ocr
Demo:
import pytesseract
from PIL import Image
image = Image.open("1.jpg")
text = pytesseract.image_to_string(image,lang='chi_sim') #使用简体中文解析图片
print(text)
还是有误差.
参考博客:
https://www.cnblogs.com/hupeng1234/p/7136442.html
https://blog.csdn.net/dcba2014/article/details/78969658
http://www.inimei.cn/archives/770.html
https://blog.csdn.net/guzhenping/article/details/80122947
安装方法:(ubuntu16.04,其他版本没试过)
sudo add-apt-repository ppa:alex-p/tesseract-ocr
sudo apt-get update
参考博客:
https://www.cnblogs.com/cnlian/p/5765871.html
https://www.cnblogs.com/wzben/p/5930538.html