证件照合规性检测

接口地址:https://api.zjzapi.com/idphoto/check

请求方式:POST(application/x-www-form-urlencoded)

返回格式:json

接口费用:检测成功扣除0.012元

请求参数:

分类 名称 必填 类型 说明
基础参数 key string 应用的key
image string base64后的图片内容,大小不超过3M,尺寸小于2000x2000。
规格参数 item_id int 规格id,《查看规格列表》
width_px int 证件照宽(px),若提供 item_id 可省略
height_px int 证件照高(px),若提供 item_id 可省略
dpi int 图片分辨率,常见300、350,若提供 item_id 可省略
file_size_min int 最小文件大小(kb),若提供 item_id 可省略
file_size_max int 最大文件大小(kb),若提供 item_id 可省略
file_format string 照片格式,仅支持: jpg、jpeg、png
bg_colors string 颜色名称(blue、white、red),支持传多个,格式为:"blue,white",若提供 item_id 可省略
solid_bg int 纯色背景检测(0/1)
人像构图 / 位置比例 face_width_ratio_min float 人脸宽度最小比例(0.01 - 1.0)
face_width_ratio_max float 人脸宽度最大比例(0.01 - 1.0)
head_height_ratio_min float 头部高度最小比例(0.01 - 1.0)
head_height_ratio_max float 头部高度最大比例(0.01 - 1.0)
eye_distance_ratio_min float 双眼间距最小比例(0.01 - 1.0)
eye_distance_ratio_max float 双眼间距最大比例(0.01 - 1.0)
head_top_gap_ratio_min float 头顶离上边缘最小比例(0.01 - 1.0)
head_top_gap_ratio_max float 头顶离上边缘最大比例(0.01 - 1.0)
eyes_to_bottom_ratio_min float 眼睛离下边缘最小比例(0.01 - 1.0)
eyes_to_bottom_ratio_max float 眼睛离下边缘最大比例(0.01 - 1.0)
姿态与完整性 head_incomplete int 头部缺失检测(0/1)
upper_body int 上半身检测(0/1)
shoulder_horizontal int 肩膀水平检测,大于设置值检测不通过,单位倾斜角度,推荐值:5
face_pose_pitch int 面部姿势俯仰角(低头/抬头),大于设置度数检测不通过,单位倾斜角度,推荐值:15
face_pose_yaw int 面部姿势偏航角(左/右转头),大于设置度数检测不通过,单位倾斜角度,推荐值:15
face_pose_roll int 面部姿势滚角(歪头/倾斜),大于设置度数检测不通过,单位倾斜角度,推荐值:15
画质与光照 face_yinyang int 阴阳脸检测,大于设置值检测不通过,计算亮度差,推荐值:60
face_clarity float 面部清晰度,小于设置值最低值检测不通过,评分越高越清晰,推荐值:0.5
face_brightness float 面部亮度,小于设置值最低值检测不通过,推荐值:0.3
face_exposure float 面部曝光,大于设置检测不通过,推荐值:0.85
face_retouch int 美颜精修(0/1)
遮挡与表情 hair_shoulder int 头发遮挡肩膀(0/1)
hair_eyebrow int 头发遮挡眉毛(0/1)
face_mask int 口罩检测(0/1)
face_block int 面部遮挡(0/1)
face_eye int 眼睛检测(0/1),闭眼或者未直视镜头
ear int 耳朵检测(0/1),双耳朵检测到才会通过,本身露不出的也会检测通过
mouth int 张嘴检测(0/1)
服装与饰品 shirtless int 着装检测(0/1),光膀子
revealing_clothing int 衣着暴露(0/1),领口大,吊带等
tint_clothes int 浅色衣服(0/1)
cap int 帽子检测(0/1)
glasses int 眼镜检测(0/1)
earphone int 耳机检测(0/1)
necklace int 项链检测(0/1)
earrings int 耳饰检测(0/1)
headwear int 头饰检测(0/1)

返回参数:

名称 类型 说明
code int 状态码(0=成功,-1=错误)
msg string 错误提示
data array 数据集

JSON返回示例:

{
    "data": {
        "passed_status": 0, # 总检测结果,1=通过,0=不通过
        "passed_list": [    # 各检测项结果
            {
                "key": "width_px",
                "passed": 0,            # 1=通过,0=不通过
                "msg": "图片宽度错误",    # 检测提示
                "detail": {             # 检测详情
                    "unit": "px",       # 单位
                    "actual": 358       # 检测结果值
                }
            },
            {
                "key": "height_px",
                "passed": 0,
                "msg": "图片高度错误",
                "detail": {
                    "unit": "px",
                    "actual": 441
                }
            },
            {
                "key": "dpi",
                "passed": 0,
                "msg": "图片dpi错误",
                "detail": {
                    "unit": "dpi",
                    "actual": 0
                }
            },
            {
                "key": "file_format",
                "passed": 1,
                "msg": "",
                "detail": {}
            },
            {
                "key": "face_pose_yaw",
                "passed": 1,
                "msg": "",
                "detail": {
                    "unit": "degree",
                    "actual": 1.29
                }
            },
            {
                "key": "bg_colors",
                "passed": 0,
                "msg": "背景色错误",
                "detail": {}
            },
            {
                "key": "face_clarity",
                "passed": 1,
                "msg": "",
                "detail": {
                    "unit": "score",
                    "actual": 0.6
                }
            }
        ]
    },
    "code": 0,
    "msg": "检测成功"
}