Skip to content

身份证识别


接口描述

身份证识别,通过光学字符识别技术,识别身份证正面的 6 个字段(姓名,性别,年龄,地址,身份证号),以及身份证反面的两个字段(签发机关,有效期).

请求说明

HTTP 方法:

POST

请求 URL V2(建议使用):

/ai-cloud-face/ocr/idcard

Header如下:

参数名称
Content-Typeapplication/json;charset=UTF-8

Body中放置请求参数,参数详情如下:

请求参数:

参数名称必填数据类型长度参数描述
imgString1-3000k待处理图片(base64 编码),原始图片大小需要小于 3M;
getFaceString0-11:返回截取的人脸图片,0:不返回人脸图片(默认);正面身份证才返回结果
checkPrintString0-1是否需要进行身份证质检(非必填) 1:需要进行身份证质检 空或非1:不进行身份证质检 (默认值为1)
getIdCardImgString0-1是否需要返回对齐后身份证图片(非必填) 1:需要返回对齐后的身份证图片 空或非1:不需要返回对齐后的身份证图片
busFlowIdString0-64业务流水号,业务系统唯一序列号(对账用,建议传入)

请求示例:

{
    "img":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQ......"
}

返回说明

返回参数:

返回值名称数据类型长度描述
codeint1-8返回结果,0表示成功
messageString1-255返回码描述
dataObject-返回的数据
-busFlowIdString1-64业务流水号,业务系统唯一序列号
-flowIdString1-64交易流水ID(建议保存)
-typeint11表示正面,0表示反面
-addressString1-255地址
-nameString1-32姓名
-folkString1-4民族
-cardnoString1-32身份证号码
-birthdayString1-16出生日期
-sexString1-4性别
-idCardImgString1-200k人脸图片数据(base64编码)
-codeString1-40:正常身份证 1:黑白复印件 2:临时身份证 3:彩色复印件 4:翻拍 5:ps 6:身份证裁剪 7:曝光不足 8:过度曝光 9:图片模糊 -1:介质检测错误未知
-validdate1String1-16有效期开始日期,如20120222
-validdate2String1-16有效期结束日期,如20220221
-authorityString1-32签发机关
-cardnoString1-32身份证号码
-faceObject-返回的人脸信息
--leftint4人脸在身份证中 x 坐标
--topint4人脸在身份证中y 坐标
--widthint4人脸宽度
--heightint4人脸高度
--imageString1-200k人脸图片(base64 编码)
-detailsObject-身份证介质和质量检测详细结果(checkPrint为1的情况下才返回)
--dielectricObject-介质
---codeString40 - real, 原件 1 - black,黑白复印件 2 - color,彩色复印件 3 - fanpai,翻拍 -1 - others
---scoredouble[]4置信度分数 score[0] 原件置信度 score[1] 黑白复印件置信度 score[2] 彩色复印件置信度 score[3] 翻拍置信度
--psObject-Ps检测
---codeString40 - real,原件 1 - ps, ps图片 -1 - others
---scoredouble[]4score[0] 原件置信度 score[1] ps图片件置信度
--completenessObject-身份证完整性检测
---codeString40 - complete, 完整的身份证图片 1 - crop, 身份证图片裁剪 2 - cover, 身份证图片遮挡 -1 - others
---scoredouble[]4score[0] 完整的身份证图片置信度 score[1] 身份证图片裁剪置信度 score[2] 身份证图片遮挡置信度
--exposureObject-光线检测
---codeString40 - properexposure, 光线正常 1 - underexposure, 光线过暗 2 - overexposure, 光线过亮 -1 - others
---scoredouble[]4score[0] 光线正常置信度 score[1] 光线过暗置信度 score[2] 光线过亮置信度
--blurObject-清晰度检测
---codeString40 - clear, 清晰 1 - blur, 模糊 -1 - others
---scoredouble[]4score[0] 清晰置信度 score[1] 模糊置信度
--typeObject-身份证类型
---codeString40 - face, 身份证人像面 1 - emblem,身份证国徽面 2 - temporary, 临时身份证 -1 - others
---scoredouble[]4score[0] 身份证人像面置信度 score[1] 身份证国徽面置信度 score[2] 临时身份证置信度
-busFlowIdString1-64传入的业务流水号

返回示例:

{
    "code": 0,
    "data": {
        "birthday": "1994年09月15日",
        "address": "xx省xx县xx镇xx村49号",
        "city": "xx县",
        "sex": "女",
        "imageLog": "2018_09_18_09_28_22_0788_1[Idcard].jpg",
        "type": "1",
        "version": "6.1.0.20180403",
        "cardno": "44082519940xxxxxx8",
        "face": {
            "image": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBA......"
            "top": 91,
            "left": 238,
            "width": 54,
            "height": 54
        },
        "province": "广东省",
        "localHost": "10.0.2.102",
        "name": "潘盼",
        "folk": "汉",
        "details": {
            "blur": {
                "code": "0",
                "score": [
                    0.849427,
                    0.150573
                ]
            },
            "completeness": {
                "code": "0",
                "score": [
                    0.991098,
                    0.007185,
                    0.001717
                ]
            },
            "dielectric": {
                "code": "0",
                "score": [
                    0.9999,
                    1.8E-5,
                    1.0E-6,
                    8.0E-5
                ]
            },
            "exposure": {
                "code": "0",
                "score": [
                    0.868391,
                    0.099581,
                    0.032028
                ]
            },
            "ps": {
                "code": "0",
                "score": [
                    0.848491,
                    0.151508
                ]
            },
            "type": {
                "code": "0",
                "score": [
                    0.999911,
                    1.7E-5,
                    7.2E-5
                ]
            }
        }
    },
    "success": true,
    "message": "success"
}

是否仍需要帮助? 请保持联络!