由于識別ocr有的頻率不高,圖片無保密性需求,也不想太大的庫,
就決定還是用下api算了,試用了幾家,決定用百度的ocr包,相對簡單。
遇到的問題里面下列基本有提到:例如獲取ID,KEY;例如安裝庫;
參考帖子:python+百度OCR的使用方法(踩坑+測試程序)_no module named 'aip-CSDN博客
遇到的坑1,標準版的ocr通用識別,精準度不夠,換為高精版;
pip install baidu-aip
pip install chardet?文章來源:http://www.zghlxwxcb.cn/news/detail-738352.html
代碼如下:文章來源地址http://www.zghlxwxcb.cn/news/detail-738352.html
from aip import AipOcr
""" 你的 APPID AK SK """
APP_ID = 'xxx'
API_KEY = 'xxx'
SECRET_KEY = 'xxx'
client = AipOcr(APP_ID, API_KEY, SECRET_KEY)
with open("1.png", 'rb') as f:
image = f.read()
#basicAccurate#handwriting
res_image = client.basicAccurate(image)
print(res_image)
with open("1.jpg", 'rb') as f:
image = f.read()
res_image = client.basicAccurate(image)
print(res_image)
到了這里,關(guān)于使用了百度OCR,記錄一下的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!