首页 > 其他 > 详细

身份证

时间:2020-11-28 09:31:16      阅读:34      评论:0      收藏:0      [点我收藏+]
from aip import AipOcr
import json

""" 你的 APPID AK SK """
APP_ID = ‘23053404‘
API_KEY = ‘4fektc6XrMhx2zVBCi74yWGo‘
SECRET_KEY = ‘ifOvfsPDyjs2taTwb1gGrUbNmZPV2ju‘

client = AipOcr(APP_ID, API_KEY, SECRET_KEY)



# 初始化AipFace对象
aipOcr = AipOcr(APP_ID, API_KEY, SECRET_KEY)

# 读取图片
filePath1 = "1.png"  # 正面
filePath2 = "2.png"  # 背面


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


options = {}
options["detect_direction"] = "true"  # 检测朝向
options["detect_risk"] = "true"
# 是否开启身份证风险类型(身份证复印件、临时身份证、身份证翻拍、修改过的身份证)功能,默认不开启

result1 = aipOcr.idcard(get_file_content(filePath1), ‘front‘, options)
result2 = aipOcr.idcard(get_file_content(filePath2), ‘back‘, options)
print(result1)
print(result2)
for key in result1[‘words_result‘].keys():
    print(key + ‘:‘ + result1[‘words_result‘][key][‘words‘])

for key in result2[‘words_result‘].keys():
    print(key + ‘:‘ + result2[‘words_result‘][key][‘words‘])

百度云的使用

技术分享图片技术分享图片技术分享图片技术分享图片技术分享图片技术分享图片

腾讯云的使用 方式介绍 https://cloud.tencent.com/document/product/866/34681

身份证

原文:https://www.cnblogs.com/ln-xxx/p/14049178.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!