fix(h5): ease camera capture requirements and rename page title
This commit is contained in:
@@ -28,10 +28,14 @@ const options = { count: 1, target: 'front', width: 600, height: 600, offsetX: 0
|
||||
const check = (d, changes) => Quality.evaluate(d, { ...options, ...changes });
|
||||
assert(check(face()).ok);
|
||||
assert(!check(null).ok); assert(!check(face(), { count: 2 }).ok);
|
||||
for (const yaw of [-14, 14]) assert(!check(face(yaw)).ok);
|
||||
for (const pitch of [-18, 18]) assert(!check(face(0, pitch)).ok);
|
||||
assert.equal(check(face(0, 0, 15)).hint, '请勿歪头');
|
||||
for (const yaw of [-14, 14]) assert(check(face(yaw)).ok, 'former strict front limit now passes');
|
||||
for (const yaw of [-16, 16]) assert(!check(face(yaw)).ok);
|
||||
for (const pitch of [-17, 17]) assert(check(face(0, pitch)).ok);
|
||||
for (const pitch of [-20, 20]) assert(!check(face(0, pitch)).ok);
|
||||
assert(check(face(0, 0, 12)).ok, 'normal tilt now passes');
|
||||
assert.equal(check(face(0, 0, 16)).hint, '请勿歪头');
|
||||
for (const yaw of [25, 72]) assert(!check(face(yaw), { target: 'right' }).ok);
|
||||
for (const yaw of [32, 68]) assert(check(face(yaw), { target: 'right' }).ok);
|
||||
assert(check(face(45), { target: 'right' }).ok);
|
||||
assert(!check(face(45), { target: 'left' }).ok);
|
||||
assert(check(face(-45), { target: 'left' }).ok);
|
||||
@@ -39,22 +43,29 @@ assert(check(face(-45), { target: 'right', mirrored: true }).ok);
|
||||
assert(check(face(-45), { target: 'right', ignoreDirection: true }).ok);
|
||||
assert(!check(face(25), { target: 'left', ignoreDirection: true }).ok);
|
||||
for (const luma of [null, 50, 240, NaN]) assert(!check(face(), { luma }).ok);
|
||||
assert(!check(face(), { offsetX: .15 }).ok);
|
||||
for (const changes of [{ height: 180 }, { height: 410 }, { x: -10 }, { y: 5 }]) {
|
||||
for (const luma of [70, 230]) assert(check(face(), { luma }).ok);
|
||||
assert(check(face(), { offsetX: .15 }).ok);
|
||||
assert(!check(face(), { offsetX: .17 }).ok);
|
||||
for (const changes of [{ height: 190 }, { height: 400 }, { y: 8 }]) {
|
||||
const d = face(); Object.assign(d.detection.box, changes); assert(check(d).ok, 'former framing limits now pass');
|
||||
}
|
||||
for (const changes of [{ height: 179 }, { height: 410 }, { x: -10 }, { y: 5 }]) {
|
||||
const d = face(); Object.assign(d.detection.box, changes); assert(!check(d).ok);
|
||||
}
|
||||
const weak = face(); weak.detection.score = .4; assert(!check(weak).ok);
|
||||
const weak = face(); weak.detection.score = .45; assert(check(weak).ok);
|
||||
weak.detection.score = .35; assert(!check(weak).ok);
|
||||
const obs = check(face()).observation;
|
||||
let held = Quality.hold(null, obs, 1000); assert(!held.ready);
|
||||
held = Quality.hold(held.state, obs, 1400); assert(!held.ready);
|
||||
assert(Quality.hold(held.state, obs, 1650).ready);
|
||||
assert(!Quality.hold(Quality.hold(null, obs, 1000).state, obs, 1700).ready, 'two frames never pass');
|
||||
assert(!Quality.hold(held.state, obs, 1449).ready);
|
||||
assert(Quality.hold(held.state, obs, 1450).ready);
|
||||
assert(Quality.hold(Quality.hold(null, obs, 1000).state, obs, 1450).ready, 'two stable frames at 450ms now pass');
|
||||
assert.equal(Quality.hold(held.state, null, 1700).state, null);
|
||||
assert.equal(Quality.hold(held.state, obs, 3500).state.frames, 1, 'gap resets');
|
||||
const slow = Quality.hold(Quality.hold(null, obs, 1000).state, obs, 2100);
|
||||
assert(!slow.ready, 'slow device still needs three frames');
|
||||
assert(Quality.hold(slow.state, obs, 3200).ready, '1100ms inference must not permanently prevent a stable capture');
|
||||
for (const change of [{ yaw: 6 }, { pitch: 6 }, { ratio: .6 }, { center_x: .55 }, { center_y: .56 }]) assert.equal(Quality.hold(held.state, { ...obs, ...change }, 1500).state.frames, 1, 'motion resets');
|
||||
assert(slow.ready, '1100ms inference now only needs two checked frames');
|
||||
for (const change of [{ yaw: 7 }, { pitch: 7 }, { ratio: .56 }, { center_x: .55 }, { center_y: .55 }]) assert(Quality.hold(held.state, { ...obs, ...change }, 1500).ready, 'small movement no longer resets');
|
||||
for (const change of [{ yaw: 9 }, { pitch: 9 }, { ratio: .6 }, { center_x: .56 }, { center_y: .58 }]) assert.equal(Quality.hold(held.state, { ...obs, ...change }, 1500).state.frames, 1, 'large motion still resets');
|
||||
for (const [dims, key] of [
|
||||
[[10, 50, 90], 'firm'], [[90, 10, 50], 'vita'], [[90, 50, 10], 'stab'],
|
||||
[[50, 50, 90], 'firm'], [[null, 50, 50], 'vita'], [[50.1, 50, 90], 'vita']
|
||||
@@ -74,8 +85,10 @@ assert.equal(Diagnostics.assess(raw).status, 'invalid');
|
||||
assert.equal(Diagnostics.assess({}).status, 'unavailable');
|
||||
assert.equal(Diagnostics.assess(raw).views.right.status, 'valid');
|
||||
const normalized = Diagnostics.normalize({ version: Quality.config.version, secret: 'discard', views: { front: { mode: 'live', yaw: 1, score: .9, luma: Infinity, secret: 'discard' }, left: { mode: 'unchecked', reason: 'model-unavailable' } } });
|
||||
assert.equal(normalized.policy.capture.holdMs, 650);
|
||||
assert.equal(normalized.policy.capture.holdMs, 450);
|
||||
assert.equal(normalized.policy.capture.minFrames, 2);
|
||||
assert.equal(normalized.version, '2026-10-12-fourth-v2');
|
||||
assert.equal(normalized.views.front.luma, undefined);
|
||||
assert(!JSON.stringify(normalized).includes('discard'));
|
||||
assert.equal(Diagnostics.normalize({ version: '<script>' }).version, 'unknown');
|
||||
console.log('PASS: stricter local pose/framing/light/single-face gates; 650ms/3-frame stability/motion/miss/gap reset; all focus cases/ties/missing/saved scores; no wrinkle mutations; backend quality marking and bounded client diagnostics');
|
||||
console.log('PASS: former strict pose/framing/light/motion limits now pass; invalid views/multiple faces/cropping/large movement still rejected; 450ms/2-frame stability/miss/gap reset; focus/history/backend diagnostics');
|
||||
|
||||
Reference in New Issue
Block a user