用百度AI识别图片中的文字,精度高

具体内容参考此文章。

https://jingyan.baidu.com/article/4b52d702c7fb86fc5d774b61.html


from aip import AipOcr
import re

APP_ID='***'
API_KEY='***'
SECRET_KEY='***'
client=AipOcr(APP_ID,API_KEY,SECRET_KEY)
i=open(r'1.jpg','rb')
img=i.read()
msg=client.basicGeneral(img)
# msg是一个字典,其中words_result中包含了文字信息
for i in msg.get('words_result'):
    print(i.get('words'))

猜你喜欢

转载自blog.csdn.net/mengtianwxs/article/details/80372021