0
点赞
收藏
分享

微信扫一扫

通过Python的pytesseract库识别图片中的文字

文章目录


前言


一、pytesseract

1.pytesseract是什么?

2.安装pytesseract

pip install pytesseract

3.查看pytesseract版本

pip show pytesseract

4.安装PIL

pip install pillow

5.查看PIL版本

pip show pillow

二、Tesseract OCR

1.Tesseract OCR是什么?

2.安装Tesseract OCR

brew install tesseract

3.安装 Tesseract OCR 语言包

brew install tesseract-lang

三、使用方法

1.引入库

import pytesseract
from PIL import Image

2.打开图片文件

img = Image.open("demo.png")

3.使用Tesseract进行文字识别

text = pytesseract.image_to_string(img, lang='chi_sim')

4.输出识别结果

print(text)

总结

举报

相关推荐

0 条评论