feat: 接口5 新增 face_measure(复用接口1测量数值)+ 接口1 七眼 eye1~eye7
接口5(/api/v1/hairline/generate)在发际线结果基础上新增 data.face_measure, 复用接口1的四庭七眼测量数值(四庭/七眼 eye1~eye7/landmarks/姿态), 不含标注图;独立流程容错,测量失败时为 null 不影响发际线主结果。 重构:提取 _run_face_measure_data() 共用函数,接口1/6 改调它再补标注图, 行为不变(43 测试全过,错误码 1001/1003/1008 回归正常)。 接口1/5 七眼新增 eye1~eye7 从左到右 7 段宽度(cm),eye1/eye7 耳朵不可见 时为 null(保留键)。 测试页 test_interface5.html:移除点击切换卡片网格改为所有发型平铺, 新增四庭七眼测量卡片。前端接入页 integration.html / 接口文档同步更新。
This commit is contained in:
+52
-2
@@ -128,6 +128,15 @@
|
||||
| face_width_cm | number | 脸宽(cm) |
|
||||
| inter_eye_distance_cm | number | 两眼间距(cm) |
|
||||
| ratios | object | 七眼各段占脸宽的比例 |
|
||||
| eye1 | number \| null | 从左到右第 1 段宽度(cm):人头最左 → 左脸颊(左耳外侧段)。该侧耳朵不可见时为 null |
|
||||
| eye2 | number | 从左到右第 2 段宽度(cm):左脸颊 → 左眼外角 |
|
||||
| eye3 | number | 从左到右第 3 段宽度(cm):左眼外角 → 左眼内角(左眼宽度) |
|
||||
| eye4 | number | 从左到右第 4 段宽度(cm):左眼内角 → 右眼内角(两眼间距) |
|
||||
| eye5 | number | 从左到右第 5 段宽度(cm):右眼内角 → 右眼外角(右眼宽度) |
|
||||
| eye6 | number | 从左到右第 6 段宽度(cm):右眼外角 → 右脸颊 |
|
||||
| eye7 | number \| null | 从左到右第 7 段宽度(cm):右脸颊 → 人头最右(右耳外侧段)。该侧耳朵不可见时为 null |
|
||||
|
||||
> `eye1`~`eye7` 为从左到右共 7 段宽度,与标注图竖线一一对应。最左/最右端线取自耳朵分割外缘;某侧耳朵被头发或侧脸遮挡(不可见)时该侧端线省略,对应 `eye1` 或 `eye7` 为 `null`(键始终保留),实际有效段为 5 或 6 段。`eye3`/`eye5` 为左右眼宽、`eye4` 为两眼间距,与 `eye_width_cm` / `inter_eye_distance_cm` 语义一致。
|
||||
|
||||
### 标注图片(UI)规范
|
||||
|
||||
@@ -161,7 +170,9 @@
|
||||
"eye_width_cm": 3.44,
|
||||
"face_width_cm": 24.08,
|
||||
"inter_eye_distance_cm": 3.44,
|
||||
"ratios": { "eye_width": 0.143, "inter_eye_distance": 0.143 }
|
||||
"ratios": { "eye_width": 0.143, "inter_eye_distance": 0.143 },
|
||||
"eye1": 3.44, "eye2": 3.44, "eye3": 3.44, "eye4": 3.44,
|
||||
"eye5": 3.44, "eye6": 3.44, "eye7": 3.44
|
||||
},
|
||||
"landmarks": {
|
||||
"hair_top": { "x": 540, "y": 120 },
|
||||
@@ -396,6 +407,7 @@
|
||||
|------|------|------|
|
||||
| hairline_images | object[] | **选中发型**列表,**数量 = 所选发型数**,元素见下表 |
|
||||
| best_hairline_center_point | object | **首个选中发型**的 middle 档发际线曲线「面部中间点」坐标,原图像素:`{ "x": number, "y": number }` |
|
||||
| face_measure | object \| null | **复用接口1**的四庭七眼测量**数值**(不含标注图)。独立流程,测量失败(无人脸/非正面/分割失败)时为 `null`,不影响发际线主结果。字段结构见下表 |
|
||||
|
||||
`hairline_images` 元素:
|
||||
|
||||
@@ -410,6 +422,19 @@
|
||||
|
||||
> worker 侧返回 `image_middle_base64` / `image_high_base64` / `image_low_base64` / `grown_image_base64`,网关落盘后改写为上表对应的 `*_url`。
|
||||
|
||||
`face_measure` 元素(与[接口1](#接口-1四庭七眼测量标注接口)的 `data` 同构,**不含** `annotated_image_*` 标注图字段):
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| face_total_height_cm | number | 全脸总高度(cm)= 四庭之和 |
|
||||
| four_courts | object | 四庭数据(顶/上/中/下庭 cm + 占比 ratios),结构同接口1 |
|
||||
| seven_eyes | object | 七眼数据(眼宽/脸宽/两眼间距 cm + 占比 ratios + eye1~eye7 从左到右 7 段宽度),结构同接口1 |
|
||||
| landmarks | object | 5 个纵向关键点像素坐标(hair_top/hairline/brow_center/nose_bottom/chin_tip),结构同接口1 |
|
||||
| hairline_source | string | 发际线来源:`segmentation`(真实分割)/ `estimated`(比例估算) |
|
||||
| head_pose | object | 头部姿态角度(yaw/pitch/roll,单位:度) |
|
||||
|
||||
> `eye1`~`eye7` 为从左到右共 7 段宽度,eye1=左耳外段、eye7=右耳外段,某侧耳朵不可见时对应段为 `null`。详见接口1说明。
|
||||
|
||||
### 响应示例(当前 Mock 返回值)
|
||||
|
||||
```json
|
||||
@@ -436,7 +461,32 @@
|
||||
"order": 3
|
||||
}
|
||||
],
|
||||
"best_hairline_center_point": { "x": 540, "y": 430 }
|
||||
"best_hairline_center_point": { "x": 540, "y": 430 },
|
||||
"face_measure": {
|
||||
"face_total_height_cm": 26.76,
|
||||
"four_courts": {
|
||||
"top_court_cm": 5.77, "upper_court_cm": 5.93,
|
||||
"middle_court_cm": 7.62, "lower_court_cm": 7.44,
|
||||
"ratios": { "top_court": 0.216, "upper_court": 0.222,
|
||||
"middle_court": 0.285, "lower_court": 0.278 }
|
||||
},
|
||||
"seven_eyes": {
|
||||
"eye_width_cm": 2.76, "face_width_cm": 15.08,
|
||||
"inter_eye_distance_cm": 3.9,
|
||||
"ratios": { "eye_width": 0.183, "inter_eye_distance": 0.259 },
|
||||
"eye1": null, "eye2": 3.0, "eye3": 2.76, "eye4": 3.9,
|
||||
"eye5": 2.76, "eye6": 3.0, "eye7": null
|
||||
},
|
||||
"landmarks": {
|
||||
"hair_top": { "x": 504, "y": 103 },
|
||||
"hairline": { "x": 504, "y": 228 },
|
||||
"brow_center": { "x": 504, "y": 357 },
|
||||
"nose_bottom": { "x": 505, "y": 522 },
|
||||
"chin_tip": { "x": 506, "y": 683 }
|
||||
},
|
||||
"hairline_source": "segmentation",
|
||||
"head_pose": { "yaw": -1.39, "pitch": 2.49, "roll": -0.06 }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user