Python识别图片内容

首先安装图片识别工具tesseract-OCR

下载地址: http://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-setup-4.00.00dev.exe

tesseract安装教程:https://blog.csdn.net/showgea/article/details/82656515

安装成功后还需要在pycharm中引入PIL扩展库,注意PIL只适用于Python2.7之前的版本,这里需要引入pillow

然后还需要引入pytesseract包

然后执行如下代码:

import pytesseract
from PIL import Image
im=Image.open(r'./image/1.png')
print(pytesseract.image_to_string(im,lang='chi_sim'))

所识别的图片:

 

 识别的结果:

 

posted on 2020-04-15 20:49  一往无前!  阅读(584)  评论(0编辑  收藏  举报