11.提取图片的文字(OCR)
实现提取图片的文字是通过安装使用谷歌的 Tesseract-OCR,首先需要从下面这个网址中下载:

https://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-setup-3.05.02-20180621.exe

接着再进行安装:

pip install pytesseract

实现代码如下所示:

import pytesseract

pytesseract.pytesseract.tesseract_cmd = '/usr/local/bin/tesseract'
img = cv2.imread('pytext.png')
pytesseract.image_to_string(img)
————————————————
版权声明:本文为CSDN博主「spearhead_cai」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/lc013/article/details/107373733