主题
身份证识别
接口描述
身份证识别,通过光学字符识别技术,识别身份证正面的 6 个字段(姓名,性别,年龄,地址,身份证号),以及身份证反面的两个字段(签发机关,有效期).
请求说明
HTTP 方法:
POST
请求 URL V2(建议使用):
/ai-cloud-face/ocr/idcard
Header如下:
参数名称 | 值 |
---|---|
Content-Type | application/json;charset=UTF-8 |
Body中放置请求参数,参数详情如下:
请求参数:
参数名称 | 必填 | 数据类型 | 长度 | 参数描述 |
---|---|---|---|---|
img | 是 | String | 1-3000k | 待处理图片(base64 编码),原始图片大小需要小于 3M; |
getFace | 否 | String | 0-1 | 1:返回截取的人脸图片,0:不返回人脸图片(默认);正面身份证才返回结果 |
checkPrint | 否 | String | 0-1 | 是否需要进行身份证质检(非必填) 1:需要进行身份证质检 空或非1:不进行身份证质检 (默认值为1) |
getIdCardImg | 否 | String | 0-1 | 是否需要返回对齐后身份证图片(非必填) 1:需要返回对齐后的身份证图片 空或非1:不需要返回对齐后的身份证图片 |
busFlowId | 否 | String | 0-64 | 业务流水号,业务系统唯一序列号(对账用,建议传入) |
请求示例:
{
"img":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQ......"
}
返回说明
返回参数:
返回值名称 | 数据类型 | 长度 | 描述 |
---|---|---|---|
code | int | 1-8 | 返回结果,0表示成功 |
message | String | 1-255 | 返回码描述 |
data | Object | - | 返回的数据 |
-busFlowId | String | 1-64 | 业务流水号,业务系统唯一序列号 |
-flowId | String | 1-64 | 交易流水ID(建议保存) |
-type | int | 1 | 1表示正面,0表示反面 |
-address | String | 1-255 | 地址 |
-name | String | 1-32 | 姓名 |
-folk | String | 1-4 | 民族 |
-cardno | String | 1-32 | 身份证号码 |
-birthday | String | 1-16 | 出生日期 |
-sex | String | 1-4 | 性别 |
-idCardImg | String | 1-200k | 人脸图片数据(base64编码) |
-code | String | 1-4 | 0:正常身份证 1:黑白复印件 2:临时身份证 3:彩色复印件 4:翻拍 5:ps 6:身份证裁剪 7:曝光不足 8:过度曝光 9:图片模糊 -1:介质检测错误未知 |
-validdate1 | String | 1-16 | 有效期开始日期,如20120222 |
-validdate2 | String | 1-16 | 有效期结束日期,如20220221 |
-authority | String | 1-32 | 签发机关 |
-cardno | String | 1-32 | 身份证号码 |
-face | Object | - | 返回的人脸信息 |
--left | int | 4 | 人脸在身份证中 x 坐标 |
--top | int | 4 | 人脸在身份证中y 坐标 |
--width | int | 4 | 人脸宽度 |
--height | int | 4 | 人脸高度 |
--image | String | 1-200k | 人脸图片(base64 编码) |
-details | Object | - | 身份证介质和质量检测详细结果(checkPrint为1的情况下才返回) |
--dielectric | Object | - | 介质 |
---code | String | 4 | 0 - real, 原件 1 - black,黑白复印件 2 - color,彩色复印件 3 - fanpai,翻拍 -1 - others |
---score | double[] | 4 | 置信度分数 score[0] 原件置信度 score[1] 黑白复印件置信度 score[2] 彩色复印件置信度 score[3] 翻拍置信度 |
--ps | Object | - | Ps检测 |
---code | String | 4 | 0 - real,原件 1 - ps, ps图片 -1 - others |
---score | double[] | 4 | score[0] 原件置信度 score[1] ps图片件置信度 |
--completeness | Object | - | 身份证完整性检测 |
---code | String | 4 | 0 - complete, 完整的身份证图片 1 - crop, 身份证图片裁剪 2 - cover, 身份证图片遮挡 -1 - others |
---score | double[] | 4 | score[0] 完整的身份证图片置信度 score[1] 身份证图片裁剪置信度 score[2] 身份证图片遮挡置信度 |
--exposure | Object | - | 光线检测 |
---code | String | 4 | 0 - properexposure, 光线正常 1 - underexposure, 光线过暗 2 - overexposure, 光线过亮 -1 - others |
---score | double[] | 4 | score[0] 光线正常置信度 score[1] 光线过暗置信度 score[2] 光线过亮置信度 |
--blur | Object | - | 清晰度检测 |
---code | String | 4 | 0 - clear, 清晰 1 - blur, 模糊 -1 - others |
---score | double[] | 4 | score[0] 清晰置信度 score[1] 模糊置信度 |
--type | Object | - | 身份证类型 |
---code | String | 4 | 0 - face, 身份证人像面 1 - emblem,身份证国徽面 2 - temporary, 临时身份证 -1 - others |
---score | double[] | 4 | score[0] 身份证人像面置信度 score[1] 身份证国徽面置信度 score[2] 临时身份证置信度 |
-busFlowId | String | 1-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"
}
是否仍需要帮助? 请保持联络!