• OCR图片文字识别


     1 #从相应的aip导入AipOcr模块
     2 from aip import AipOcr
     3 from pandas.core.frame import DataFrame
     4 #输入凭证
     5 APP_ID="19307867"
     6 API_Key="HM1UDlzRPrr7TE6xw9YHDSnZ"
     7 Secret_Key="6jUGVGRLMrbByWz0vPs5w5NOS8m6GMOl"
     8 aipOcr=AipOcr(APP_ID,API_Key,Secret_Key)
     9 
    10 """
    11 #输入资源
    12 filePath=r"路基名"
    13 for i in range(1,图片编号):
    14     filePath1=filePath+"\\"+"图片名(带编号的)".#最好是jpg,名称统一
    15     image=open(filePath1,"rb").read()
    16 """
    17 file='/Users/admin/Desktop/test02.jpeg'
    18 image=open(file,"rb").read()
    19 #接通ocr接口
    20 result=aipOcr.basicGeneral(image)
    21 #输出
    22 #mywords=result["words_result"]
    23 # for i in range(len(mywords)):
    24 #    print(mywords[i]["words"])
    25 # del_index=[len(mywords)-2,len(mywords)-1,0,1,2]
    26 # new_data=[mywords[i] for i in range (0,len(mywords))  if i not in del_index]
    27 # final=[]
    28 # for i in range(0,len(new_data)):
    29 #     if i % 2 ==0 and i < len(new_data)-1:
    30 #         day=new_data[i]["words"]
    31 #         data=new_data[i+1]["words"]
    32 #         final.append([day,data])
    33 # df=DataFrame(final,columns=['day','data'])
    34 # df.to_csv('202009_data.csv')
  • 相关阅读:
    通过另外一个应用程序给多个文本框赋值, 模拟单击事件
    AngularJS
    九章算法
    实现继承
    二分查找
    NET Core依赖注入解读&使用Autofac替代实现
    NET SignalR 与 LayIM2.0
    WebVR
    依赖注入
    如何实现配置与源文件的同步
  • 原文地址:https://www.cnblogs.com/zhangbojiangfeng/p/16229195.html
Copyright © 2020-2023  润新知