fix(camera): set accepted face brightness to 110–220
This commit is contained in:
@@ -6,9 +6,9 @@
|
||||
'use strict';
|
||||
// Real-phone feedback: ease alignment and normal hand/head movement while
|
||||
// retaining two checked frames, one face, framing and final JPEG validation.
|
||||
var config = Object.freeze({ version: '2026-10-15-light-150-220-v5', score: 0.4,
|
||||
var config = Object.freeze({ version: '2026-10-15-light-110-220-v6', score: 0.4,
|
||||
near: 0.30, far: 0.68, center: 0.16, edge: 0.01,
|
||||
dark: 150, bright: 220, holdMs: 450, minFrames: 2, maxGapMs: 2000,
|
||||
dark: 110, bright: 220, holdMs: 450, minFrames: 2, maxGapMs: 2000,
|
||||
yawDrift: 8, pitchDrift: 8, centerDrift: 0.055, sizeDrift: 0.065 });
|
||||
function finite(v) { return typeof v === 'number' && isFinite(v); }
|
||||
function evaluate(d, options) {
|
||||
|
||||
@@ -116,7 +116,7 @@ try {
|
||||
await page.waitForFunction(() => window.__voice.some(row => row.id === 'hint-front'));
|
||||
assert((await page.locator('#cam-step').textContent()).includes('1/3'), 'invalid frontal angle never advances');
|
||||
assert.equal(await page.evaluate(() => window.__voice.some(row => /^hint-turn-|^step[23]-|^shot-done$/.test(row.id))), false, 'no turn/next-step/completion audio before a successful front photo');
|
||||
await page.evaluate(() => window.__cameraFixture.set('C3_180.jpg'));
|
||||
await page.evaluate(() => { window.__cameraFixture.light(.6); return window.__cameraFixture.set('C3_180.jpg'); });
|
||||
await page.waitForFunction(()=>window.__evaluations.some(row=>row.target==='front'&&!row.ok&&row.hint==='请到光线充足处'));
|
||||
assert((await page.locator('#cam-step').textContent()).includes('1/3'),'dim sample cannot advance');
|
||||
// Simulate improving room lighting, not bypassing the actual quality gate.
|
||||
@@ -152,7 +152,7 @@ try {
|
||||
for (const key of ['front', 'left', 'right']) {
|
||||
const row = body.capture_diagnostics.views[key];
|
||||
assert.equal(row.mode, 'live'); assert.equal(row.direction_checked, true);
|
||||
assert(row.score >= .4 && row.luma >= 150 && row.luma <= 220);
|
||||
assert(row.score >= .4 && row.luma >= 110 && row.luma <= 220);
|
||||
assert(Math.abs(row.roll) <= 18);
|
||||
}
|
||||
assert(Math.abs(body.capture_diagnostics.views.front.yaw) <= 18);
|
||||
|
||||
@@ -61,8 +61,8 @@ assert.equal(check(null).reason, 'quality');
|
||||
assert.equal(check(face(), { count: 2 }).reason, 'quality');
|
||||
const brokenLandmarks = face(); brokenLandmarks.landmarks.positions = [];
|
||||
assert.equal(check(brokenLandmarks).reason, 'quality', 'unreadable pose is not confirmed wrong angle');
|
||||
for (const luma of [150, 150.01, 180, 219.99, 220]) assert(check(face(), { luma }).ok);
|
||||
for (const luma of [65,100,120,149.99]) assert.equal(check(face(),{luma}).hint,'请到光线充足处');
|
||||
for (const luma of [110,110.01,120,149.99,180,219.99,220]) assert(check(face(), { luma }).ok);
|
||||
for (const luma of [65,100,109.99]) assert.equal(check(face(),{luma}).hint,'请到光线充足处');
|
||||
for (const luma of [220.01,235,255]) assert.equal(check(face(),{luma}).hint,'光线过强,请避开强光');
|
||||
assert(check(face(), { offsetX: .15 }).ok);
|
||||
assert(!check(face(), { offsetX: .17 }).ok);
|
||||
@@ -116,7 +116,7 @@ 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, 450);
|
||||
assert.equal(normalized.policy.capture.minFrames, 2);
|
||||
assert.equal(normalized.version, '2026-10-15-light-150-220-v5');
|
||||
assert.equal(normalized.version, '2026-10-15-light-110-220-v6');
|
||||
assert.equal(normalized.views.front.luma, undefined);
|
||||
assert(!JSON.stringify(normalized).includes('discard'));
|
||||
assert.equal(Diagnostics.normalize({ version: '<script>' }).version, 'unknown');
|
||||
|
||||
Reference in New Issue
Block a user