检测证件照

基本信息

请求类型: HTTP/HTTPS

接口地址: http://apicall.id-photo-verify.com/api/check_pic

请求方式: POST

数据类型: JSON

响应类型: JSON

接口状态: 启用

接口描述:

检测证件照是否合格

调用此接口增加 1 次已调用次数

官网上对应的app_key应用类型必须为证件照检测

下方请求参数中带" * "的参数为检测参数,由于我们检测算法会不定期更新,检测标准也可能会出现一些变化,为方便检测参数阈值及时调整,务必将请求放至服务端进行

请求参数

参数名称 是否必须 类型 描述 示例
file str 图片的base64数据(注意不包含base64的头部数据),或者图片在oss的key(见第十三个接口)
app_key str 已申请的app_key
spec_id int 已有的规格ID
*head_length_max_p false int 脸部长度max  
*head_length_min_p false int 脸部长度min  
*head_occupy_max_p false int 脸部占比max  
*head_occupy_min_p false int 脸部占比min  
*eye_space_max_p false int 双眼间距max  
*eye_space_min_p false int 双眼间距min  
*hairline_top_max_p false string 为像素字符串时,表示头顶距离与图像顶部的距离像素,为数字0-100时,表示头顶距离与图像顶部的距离像素与图像高的比值 300px
*hairline_top_min_p false string 为像素字符串时,表示头顶距离与图像顶部的距离像素,为数字0-100时,表示头顶距离与图像顶部的距离像素与图像高的比值 10px
*eyes_center_left_max_p false int 双眼中心距图像左边缘max  
*eyes_center_left_min_p false int 双眼中心距图像左边缘min  
*eyes_space_bottom_max_p false int 双眼距图像下边缘max 414
*eyes_space_bottom_min_p false int 双眼距图像下边缘min 324
*shoulder_occupy false int 肩部占比  
*left_right_empty false int 左右各空  
*facial_width_max_p false int 脸部宽度max 284
*facial_width_min_p false int 脸部宽度min 180
*width_px false int 像素宽度,最大不能超过1050  
*height_px false int 像素高度,最大不能超过1500  
*file_size_max false int 文件大小最大值 40960
*file_size_min false int 文件大小最小值 20480
*photo_format false string 照片格式  
*facial_pose false int 人脸姿态,是人脸姿态 yaw pitch roll的集中判断见参数说明1 35
sight_line false int 视线水平,此参数为必检项,检测通过返回1,不通过为0
*facial_shelter false int 面部无遮挡(见下方参数说明2  
*eyes_close false int 闭眼 50
*eyes_nature false int 视线自然 50
*mouse_nature false int 嘴巴自然 50
*shoulder_equal false int 肩膀等高 50
*face_unbalance false int 阴阳脸 50
*glasses_glare false int 眼镜反光  
*glasses false int 是否佩戴眼镜,是thin_frame_glasses、thick_black_frame_glasses、sunglasses的综合判断 10
*thin_frame_glasses false int 细框/无框 眼镜 50
*thick_black_frame_glasses false int 粗黑框眼镜 50
*sunglasses false int 墨镜 50
*face_expression false int 脸部表情  
*face_center false int 脸部居中,此参数为必检项,不受传参的影响 1
*face_blur false int 模糊程度 50
*face_noise false int 噪声程度 20
*face_over_kbt false int 过曝光 60
*bg_shadow false int 背景阴影 60
*clothes_similar false int 服装突出 90
*chin_bottom_min_p false int 下巴距图像下边缘min  
*shoulder_missed false int 身体完整性,是肩部完整 头部完整 下半身悬空的集中判断 60
*face_width_min false int 人脸脸颊宽度(不包含耳朵)与照片宽度的最小比例  
*face_width_max false int 人脸脸颊宽度(不包含耳朵)与照片宽度的最大比例  
*missing_shoulder false int 肩部完整 30
*incomplete_head false int 头部完整 60
*lower_body_hanging false int 下半身悬空 30
*headpose_yaw false int 人脸姿态(见下方参数说明1 50
*headpose_pitch false int 人脸姿态(见下方参数说明1 50
*headpose_roll false int 人脸姿态(见下方参数说明1 50
*face_too_dark false int 照片过暗 60
*face_contrast false int 对比度异常 60
*body_posture false int 身体姿态 身子不正,自拍时斜向下,举手,手放脑后,抠鼻孔,托腮等 60
*hat_threshold false int 帽子检测 20
*bare_shouldered false int 光膀检测 60
*id_exist false int 手持证件照检测 60
*watermark_exist false int 照片有水印 50
*pn_mask_exist false int 照片有挂戴口罩 90
*background_color false list 自定义照片背景色,详见“参数说明4  
*head_pose false int 头部姿态异常 60
*decoration_occlusion false int 饰品遮挡 60
*pn_over_ps false int 过度ps,目前是第一个版本,需要使用请先联系客服咨询接口效果 60
*face_gazeNG false int 眼睛视线异常,目前是第一个版本,需要使用请先联系客服咨询接口效果 60
*deal_face_skincolor false int 肤色异常检测 60
*pn_neck_shadow_exist false int 脖子有阴影 60

响应参数

注:随着传入的spec_id的不同,响应数据的种类会有一些变化
参数名称 类型 示例 描述
code number 200 状态码
check_result number 1 检测结果汇总,各检测项中有一项未通过则为0,全部通过则为1
all_check_result obj {...} 各检测项详细数值
result object   各个参数的检查结果:1代表通过,0代表未通过
background_color number 1 背景色
bg_shadow number 1 背景阴影
chin_bottom number 1 下巴距图像下边缘
clothes_similar number 1 服装相似度
eye_space number 1 眼部距离
eyes_center_left number 1 双眼中心距图像左边缘
eyes_close number 1 闭眼程度
eyes_nature number 1 视线
eyes_space_bottom number 1 双眼中心距图像下边缘
face_blur number 1 模糊
face_center number 1 脸部居中
face_color number 1 脸部颜色(已弃用)
face_expression number 1 脸部表情
face_noise number 1 脸部噪音
face_unbalance number 1 阴阳脸
facial_pose number 1 脸部姿态
facial_shelter number 1 脸部遮挡
facial_width number 1 脸部宽度
file_size number 1 文件大小
glasses number 1 眼镜样式
glasses_glare number 1 眼镜反光
hairline_top number 1 头顶发际线
head_length number 1 头部长度
head_occupy number 1 头部占比
left_right_empty number 1 左右是否各空
mouse_nature number 1 嘴巴自然
name string 英语四六级考试 规格名字
photo_format number 1 文件类型
ppi number 1 检测ppi
px_and_mm number 1 像素和毫米大小
shoulder_equal number 1 肩膀自然
sight_line number 1 视线水平
pn_neck_shadow_exist number 1 脖子阴影
spec_id number 23 规格ID

python请求示例

import requests, json, base64
​
url = "http://apicall.id-photo-verify.com/api/check_pic"
​
with open("test.png", 'rb') as f:
	pic = f.read()
​
headers = {"Content-Type": "application/json"}
​
data = {
	"spec_id": 391,
	"app_key": "您申请的app_key",
	"file": base64.b64encode(pic).decode()
}
data_json = json.dumps(data)
response = requests.post(url, headers=headers, data=data_json)
print(response.text)
							

响应示例

{
	'all_check_result': {
		'age': 9,
		'bare_shouldered': 7,
		'bg_notpure': 0,
		'bg_shadow': 0,
		'bg_similar2clothes': 2,
		'bg_similar2temp': 23,
		'bits': 8,
		'body_missingparts': [0, 0, 0],
		'body_postureNG': 11,
		'chin_y': 281,
		'decoration': 0,
		'expressionNG': 0,
		'eyes_coordinates': [
			[159, 170],
			[198, 170]
		],
		'face_bottom': 281,
		'face_eyeclose': 0,
		'face_mouthopen': 22,
		'face_occlusion': [0, 0, 0, 0, 0, 8],
		'face_width': 157,
		'faceillum_contrastNG': 15,
		'faceillum_overDark': 0,
		'faceillum_overExpo': 0,
		'faceillum_skincolorNG': 1,
		'faceillum_unbalanced': 0,
		'facial_points': [145, 168, 211, 167, 178, 238],
		'format': 'JPEG',
		'gaze_LR': 2,
		'gaze_UD': -9,
		'glasses_glare': 0,
		'glasses_typeNG': [0, 0, 0],
		'hat_pixel_number': 0,
		'head_poseNG': 0,
		'headpose_pitch': -4,
		'headpose_roll': 2,
		'headpose_yaw': 6,
		'id_exist': 0,
		'image_blur': 10,
		'image_colorNG': 0,
		'image_noise': 0,
		'live_detection_threshold': False,
		'male': 'MAN',
		'pn_mask_exist': 0,
		'pn_neck_shadow_exist': 74,
		'ptLeftBottom': [110, 282],
		'ptLeftTop': [110, 120],
		'ptRightTop': [243, 120],
		'shoulder_nothorizontal': 17,
		'size': [358, 441],
		'top_x': 21,
		'top_x_p': 4,
		'watermark_exist': 0
	},
	'check_result': 0,
	'code': 200,
	'not_check_result': [{
		'check_param': 'hairline_top',
		'check_value': None,
		'param_message': '头顶间距'
	}],
	'result': {
		'background_color': 1,
		'clothes_similar': 1,
		'ear_occlusion': 1,
		'eyes_close': 1,
		'face_blur': 1,
		'face_center': 1,
		'face_noise': 1,
		'face_too_dark': 1,
		'facial_pose': 1,
		'hairline_top': 0,
		'headpose_pitch': 1,
		'headpose_roll': 1,
		'headpose_yaw': 1,
		'name': '一寸(蓝底)',
		'photo_format': 1,
		'pn_mask_exist': 1,
		'px_and_mm': 1,
		'shoulder_equal': 1,
		'sight_line': 1,
		'spec_id': '1'
	},
	'source_file': 'app/df9a55c770126a82f9baad62895d0e23.jpg',
	'value_dict': {
		'bare_shouldered': 7,
		'body_posture': 11,
		'cheek_occlusion': 0,
		'clothes_similar': 2,
		'deal_face_skincolor': 1,
		'ear_occlusion': 8,
		'eye_occlusion': 0,
		'eyebrow_occlusion': 0,
		'face_blur': 10,
		'face_contrast': 15,
		'facial_shelter': 8,
		'glasses': 0,
		'headpose_pitch': -4,
		'headpose_roll': 2,
		'headpose_yaw': 6,
		'incomplete_head': 0,
		'lower_body_hanging': 0,
		'missing_shoulder': 0,
		'mouse_nature': 22,
		'mouth_occlusion': 0,
		'nose_occlusion': 0,
		'pn_neck_shadow_exist': 74,
		'shoulder_equal': 17,
		'shoulder_missed': 0,
		'sunglasses': 0,
		'thick_black_frame_glasses': 0,
		'thin_frame_glasses': 0
	}
}