先上圖 不多說。
對於一般的用戶來說識別率還是能達到百分之90以上。
已經打包成exe文件。windows用戶可以直接使用。要軟件的加我QQ
python代碼:
# -*- coding: UTF-8 -*-
from aip import AipOcr
def main():
img_path = input('請輸入圖片路徑')
# 定義常量
APP_ID = 'you APP_ID'
API_KEY = 'YOU KEY'
SECRET_KEY = 'YOU SECRET_KEY'
# 初始化AipFace對象
aipOcr = AipOcr(APP_ID, API_KEY, SECRET_KEY)
# 圖片路徑
filePath = ("%s" % (img_path))
aaa = filePath.replace("\\", "\\\\")
# 讀取圖片
def get_file_content(filePath):
with open(filePath, 'rb') as fp:
return fp.read()
# 其他配置參數
options = {
'detect_direction': 'true', # 檢測圖像朝向
'language_type': 'CHN_ENG', # 識別語言類型
}
# 調用通用文字識別接口
result = aipOcr.basicGeneral(get_file_content(filePath), options)
print('\n' * 1)
print("檢測到圖片文字可能有 %s 行\n內容如下: "%(result["words_result_num"]))
fd = open("識別文字.txt",'w+')
fd.write("檢測到圖片文字可能有 %s 行\n內容如下: "%(result["words_result_num"])+'\n')
list=result["words_result"]
for i in list:
print(i["words"])
fd.write(i["words"]+'\n')
if __name__ == '__main__':
main()
print('\n' * 1)
input('\n---------------------感謝你的支持---------------------'
'\n-----------------聯系作者:386960026---------------------'
'\n---------------------按任意鍵退出---------------------')