fix(h5): ease camera capture requirements and rename page title

This commit is contained in:
xsl
2026-10-12 20:47:58 +08:00
parent 3f165bf9e5
commit c9352fe4ca
15 changed files with 960 additions and 804 deletions
+14 -14
View File
@@ -62,14 +62,14 @@
var PITCH_COEFF = 180; // 归一化偏移 → 角度 的增益
// ---- check 阈值(角度制) ----
// Fourth feedback: conservative initial local gates. Empirical pose estimates
// are not upstream quality scores; use recorded samples to calibrate further.
var FRONT_YAW_MAX = 10;
var FRONT_PITCH_MAX = 12;
var SIDE_YAW_MIN = 35;
var SIDE_YAW_MAX = 65;
var SIDE_PITCH_MAX = 15;
var ROLL_MAX = 10;
// Real-phone feedback: relaxed alignment, without accepting frontal photos
// as side views. These empirical angles are not upstream quality scores.
var FRONT_YAW_MAX = 15;
var FRONT_PITCH_MAX = 18;
var SIDE_YAW_MIN = 30;
var SIDE_YAW_MAX = 70;
var SIDE_PITCH_MAX = 20;
var ROLL_MAX = 15;
var HINT_KEEP = '保持不动';
var HINT_TURN_LEFT = '请向左转头'; // 用户向自己的左侧转
@@ -158,10 +158,10 @@
/**
* check(points, target, mirrored) -> { ok, hint }
* target: 'front' | 'left' | 'right'
* 'front' : |yaw|<=10 且 |pitch|<=12、|roll|<=10;不 ok 时给方向提示
* 'front' : |yaw|<=15 且 |pitch|<=18、|roll|<=15;不 ok 时给方向提示
* (UI 反馈 2026-10:动态提示「请向左转头」「请略微抬头」等,取代此前只提示回正)
* 'left' : 画面中看到左脸 = 被摄者头向右转(语义 yaw ∈ [-65°,-35°]),|pitch|<=15
* 'right' : 画面中看到右脸 = 被摄者头向左转(语义 yaw ∈ [35°,65°]),|pitch|<=15
* 'left' : 画面中看到左脸 = 被摄者头向右转(语义 yaw ∈ [-70°,-30°]),|pitch|<=20
* 'right' : 画面中看到右脸 = 被摄者头向左转(语义 yaw ∈ [30°,70°]),|pitch|<=20
* ok=true 时 hint='保持不动';输入非法(含 estimate 返回 null 的退化特征点)时 ok=false、hint='请正对屏幕'。
*/
function check(points, target, mirrored) {
@@ -341,15 +341,15 @@ if (typeof module !== 'undefined' && typeof require !== 'undefined' && require.m
ok(HeadPose.estimate(tiny, false) === null, 'faceHeight 过小 → estimate 返回 null');
ok(HeadPose.check(tiny, 'front', false).hint === '请正对屏幕', 'faceHeight 过小 check 兜底');
// 13) Fourth feedback: 10° local frontal gate rejects the former 15° edge.
ok(HeadPose.config.FRONT_YAW_MAX === 10, 'config.FRONT_YAW_MAX = 10');
// 13) Phone feedback: restore the 15° frontal margin, still reject 16°+.
ok(HeadPose.config.FRONT_YAW_MAX === 15, 'config.FRONT_YAW_MAX = 15');
var slight = makeFrontal();
slight[30] = { x: 205.6, y: 140 }; // 偏移 5.6 → yaw≈14.9°(YAW_COEFF=3.8 标定)
slight[33] = { x: 205.6, y: 161.5 };
var se = HeadPose.estimate(slight, false);
ok(se.yaw > 13.5 && se.yaw <= 15, '轻微偏头 yaw∈(13.5,15] (got ' + se.yaw.toFixed(2) + ')');
var sc2 = HeadPose.check(slight, 'front', false);
ok(sc2.ok === false, 'yaw≈14.9° front 拒绝(第四轮收紧)');
ok(sc2.ok === true, 'yaw≈14.9° front 通过(真机反馈放宽)');
var slight2 = makeFrontal();
slight2[30] = { x: 206.2, y: 140 }; // 偏移 6.2 → yaw≈16.2°
slight2[33] = { x: 206.2, y: 161.5 };