标签:word 读取 color port rom 文字识别 general getc return
1 #!/usr/bin/env python 2 #created by Baird 3 4 from aip import AipOcr 5 6 def GetCaptchaV(filename): 7 APP_ID = ‘1X4X8X4X‘ 8 API_KEY = ‘YaVcqamctoYqRHNGAqwVbn97UO‘ 9 SECRET_KEY = ‘C1926rIqGstqPHTUFa6sz481fjDua2pv‘ 10 11 client = AipOcr(APP_ID, API_KEY, SECRET_KEY) 12 13 """ 读取图片 """ 14 def get_file_content(filePath): 15 with open(filePath, ‘rb‘) as fp: 16 return fp.read() 17 18 image = get_file_content(filename) 19 20 """ 调用通用文字识别, 图片参数为本地图片 """ 21 ret = client.basicGeneral(image) 22 23 code = ret["words_result"][0]["words"] 24 print("识别验证码成功===》",code) 25 return code
标签:word 读取 color port rom 文字识别 general getc return
原文地址:https://www.cnblogs.com/baird/p/9542645.html