tft每日頭條

 > 生活

 > ocr文本識别技術

ocr文本識别技術

生活 更新时间:2024-08-21 19:09:58

from aip import AipOcr APP_ID = '' API_KEY = '' SECRET_KEY = '' client = AipOcr(APP_ID,API_KEY,SECRET_KEY) '''讀取文件''' def get_file_content(filePath): with open(filePath,"rb") as fp: return fp.read() image = get_file_content('文件路徑') '''可選參數''' options = {} options["language_type"] = "CHN_ENG" options["detect_direction"] = "true" options["detect_language"] = "true" options["probability"] = "true" res = client.basicGeneral(image,options) for colume in res['words_result']: print(colume['words'])

ocr文本識别技術(文字識别AipOcr)1

程序使用的是百度的api,需要導入baidu-aip,并且需要APP_ID,API_KEY,SECRET_KEY

三個字符串。

ocr文本識别技術(文字識别AipOcr)2

百度智能雲

ocr文本識别技術(文字識别AipOcr)3

ocr文本識别技術(文字識别AipOcr)4

ocr文本識别技術(文字識别AipOcr)5

ocr文本識别技術(文字識别AipOcr)6

ocr文本識别技術(文字識别AipOcr)7

ocr文本識别技術(文字識别AipOcr)8

ocr文本識别技術(文字識别AipOcr)9

ocr文本識别技術(文字識别AipOcr)10

獲得APP_ID ,API_KEY,SECRET_KEY

此api還可以對圖片url,pdf識别,具體的使用可以參考下方的參數文檔

ocr文本識别技術(文字識别AipOcr)11

,

更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!

查看全部

相关生活资讯推荐

热门生活资讯推荐

网友关注

Copyright 2023-2024 - www.tftnews.com All Rights Reserved