调用 银行回单接口识别银行回单返回乱码
wlzsbyj 发布于2020-08 浏览:2074 回复:1
0
收藏

使用界面上的功能识别同一张银行回单,返回正常。如图附件。

 

使用phthon调用银行回单接口,返回乱码如下:

{'words_result': [{'location': {'top': 125, 'width': 217, 'height': 23, 'left': 928}, 'words': ' NGALXENE回'}, {'location': {'top': 129, 'width': 248, 'height': 21, 'left': 1275}, 'words': '000L8I9000黄回'}, {'location': {'top': 159, 'width': 383, 'height': 31, 'left': 495}, 'words': '华69-09ZI6平管'}, {'location': {'top': 165, 'width': 178, 'height': 26, 'left': 1344}, 'words': '980'}, {'location': {'top': 228, 'width': 183, 'height': 28, 'left': 219}, 'words': '回去审'}, {'location': {'top': 228, 'width': 552, 'height': 29, 'left': 932}, 'words': '2耳回针能草网上褂其'}, {'location': {'top': 257, 'width': 979, 'height': 29, 'left': 503}, 'words': '丫鼻日书业新用非回裂'}, {'location': {'top': 409, 'width': 336, 'height': 29, 'left': 1187}, 'words': '-单码8000H漫册'}, {'location': {'top': 473, 'width': 332, 'height': 27, 'left': 1186}, 'words': '[87G000HXO'}, {'location': {'top': 528, 'width': 503, 'height': 30, 'left': 324}, 'words': '削身性华()耳性国啡'}, {'location': {'top': 536, 'width': 252, 'height': 26, 'left': 1264}, 'words': '6IS69L9L9F各'}, {'location': {'top': 590, 'width': 378, 'height': 32, 'left': 447}, 'words': '身基身型母干性孕身'}, {'location': {'top': 596, 'width': 430, 'height': 28, 'left': 1091}, 'words': '提暴非园中'}, {'location': {'top': 623, 'width': 277, 'height': 27, 'left': 548}, 'words': '0600062少科'}, {'location': {'top': 627, 'width': 281, 'height': 27, 'left': 1241}, 'words': ' CLOFOOOOIFOI'}, {'location': {'top': 652, 'width': 524, 'height': 27, 'left': 301}, 'words': ' [[8F90008190/[/6I79700099 LNG'}, {'location': {'top': 657, 'width': 334, 'height': 26, 'left': 1187}, 'words': 'L8LZL088I9000不'}, {'location': {'top': 686, 'width': 274, 'height': 28, 'left': 1247}, 'words': '班暴-00杀不'}, {'location': {'top': 711, 'width': 603, 'height': 30, 'left': 918}, 'words': "2- to 'too'IZI'sdaq性"}, {'location': {'top': 756, 'width': 325, 'height': 31, 'left': 1120}, 'words': 'ㄓY'}, {'location': {'top': 796, 'width': 221, 'height': 27, 'left': 1296}, 'words': " 00'SII 8AN0"}, {'location': {'top': 863, 'width': 453, 'height': 34, 'left': 375}, 'words': '身伞母干上丫'}, {'location': {'top': 870, 'width': 504, 'height': 32, 'left': 1015}, 'words': '非国中痒丹'}, {'location': {'top': 946, 'width': 583, 'height': 32, 'left': 937}, 'words': '(非)耳国'}, {'location': {'top': 981, 'width': 384, 'height': 29, 'left': 441}, 'words': '0s669000t0'}, {'location': {'top': 984, 'width': 315, 'height': 31, 'left': 1205}, 'words': '6ET969L9L9FE'}, {'location': {'top': 1017, 'width': 266, 'height': 28, 'left': 457}, 'words': '日8T9000日'}, {'location': {'top': 1022, 'width': 232, 'height': 28, 'left': 1087}, 'words': '8iz00t'}, {'location': {'top': 1072, 'width': 191, 'height': 22, 'left': 1212}, 'words': ' WAONOXNVE'}, {'location': {'top': 1080, 'width': 434, 'height': 50, 'left': 583}, 'words': '回丹不丹国'}, {'location': {'top': 1101, 'width': 206, 'height': 50, 'left': 1208}, 'words': '图'}], 'log_id': 8017049713128368723, 'words_result_num': 31}

调用 代码如下:

from aip import AipOcr
import base64

def get_file_content(filePath):
with open(filePath, 'rb') as fp:
return fp.read()


def main():
""" 你的 APPID AK SK """
print('hello world')
APP_ID = '21894371'
API_KEY = 'Sb6gSgHwDiM5BbeLhacTnaBN'
SECRET_KEY = 'IMXgEBTtqUAayc5SyfQLiHU46oFt6hMT'

client = AipOcr(APP_ID, API_KEY, SECRET_KEY)
image = get_file_content('D:\\ATemp2\\202008\\回单\\Image_00002.jpg')
image_base64 = base64.b64encode(image)
sre = client.receipt(image)

print(sre)

if __name__ == "__main__":
main()

 

 

 

收藏
点赞
0
个赞
共1条回复 最后由用户已被禁言回复于2022-04
#2深圳九曲范深回复于2020-08

通过官方实例代码试试

0
TOP
切换版块