@idmission/websdk-core 0.2.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/dist/attestation/clientAttestation.d.ts +5 -0
- package/dist/attestation/clientAttestation.d.ts.map +1 -1
- package/dist/attestation/clientAttestation.js +4 -4
- package/dist/attestation/collectClientAttestation.d.ts +3 -1
- package/dist/attestation/collectClientAttestation.d.ts.map +1 -1
- package/dist/attestation/collectClientAttestation.js +4 -3
- package/dist/camera/acquireCamera.d.ts +5 -0
- package/dist/camera/acquireCamera.d.ts.map +1 -1
- package/dist/camera/acquireCamera.js +25 -5
- package/dist/captureProgress/actor.d.ts +30 -0
- package/dist/captureProgress/actor.d.ts.map +1 -0
- package/dist/captureProgress/actor.js +754 -0
- package/dist/captureProgress/encoder.d.ts +7 -0
- package/dist/captureProgress/encoder.d.ts.map +1 -0
- package/dist/captureProgress/encoder.js +195 -0
- package/dist/captureProgress/index.d.ts +4 -0
- package/dist/captureProgress/index.d.ts.map +1 -0
- package/dist/captureProgress/index.js +45 -0
- package/dist/captureProgress/internal.d.ts +3 -0
- package/dist/captureProgress/internal.d.ts.map +1 -0
- package/dist/captureProgress/internal.js +1 -0
- package/dist/captureProgress/protocol.d.ts +224 -0
- package/dist/captureProgress/protocol.d.ts.map +1 -0
- package/dist/captureProgress/protocol.js +106 -0
- package/dist/captureProgress/recorder.d.ts +32 -0
- package/dist/captureProgress/recorder.d.ts.map +1 -0
- package/dist/captureProgress/recorder.js +554 -0
- package/dist/captureProgress/transport.d.ts +33 -0
- package/dist/captureProgress/transport.d.ts.map +1 -0
- package/dist/captureProgress/transport.js +109 -0
- package/dist/captureProgress/types.d.ts +35 -0
- package/dist/captureProgress/types.d.ts.map +1 -0
- package/dist/captureProgress/types.js +27 -0
- package/dist/client/IdmissionClient.d.ts +6 -1
- package/dist/client/IdmissionClient.d.ts.map +1 -1
- package/dist/client/IdmissionClient.js +93 -27
- package/dist/client/approval.d.ts +15 -0
- package/dist/client/approval.d.ts.map +1 -0
- package/dist/client/approval.js +19 -0
- package/dist/client/documentFileMetadata.d.ts +13 -0
- package/dist/client/documentFileMetadata.d.ts.map +1 -0
- package/dist/client/documentFileMetadata.js +51 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -0
- package/dist/client/payload.d.ts +3 -0
- package/dist/client/payload.d.ts.map +1 -1
- package/dist/client/payload.js +1 -0
- package/dist/client/submissionMetadata.d.ts +4 -1
- package/dist/client/submissionMetadata.d.ts.map +1 -1
- package/dist/client/submissionMetadata.js +13 -8
- package/dist/client/types.d.ts +6 -0
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/validateSession.d.ts +2 -0
- package/dist/client/validateSession.d.ts.map +1 -1
- package/dist/client/validateSession.js +53 -24
- package/dist/documentCapture/autoCaptureEngine.d.ts.map +1 -1
- package/dist/documentCapture/autoCaptureEngine.js +27 -8
- package/dist/documentCapture/autoCaptureGeometry.d.ts +97 -7
- package/dist/documentCapture/autoCaptureGeometry.d.ts.map +1 -1
- package/dist/documentCapture/autoCaptureGeometry.js +87 -6
- package/dist/documentCapture/autoCaptureMetadata.d.ts +12 -4
- package/dist/documentCapture/autoCaptureMetadata.d.ts.map +1 -1
- package/dist/documentCapture/autoCaptureMetadata.js +8 -5
- package/dist/documentCapture/autoCaptureOptions.d.ts +4 -5
- package/dist/documentCapture/autoCaptureOptions.d.ts.map +1 -1
- package/dist/documentCapture/autoCaptureOptions.js +4 -5
- package/dist/documentCapture/controller.d.ts +5 -0
- package/dist/documentCapture/controller.d.ts.map +1 -1
- package/dist/documentCapture/controller.js +37 -21
- package/dist/documentCapture/index.d.ts +1 -1
- package/dist/documentCapture/index.d.ts.map +1 -1
- package/dist/documentCapture/index.js +1 -1
- package/dist/idCapture/controller.d.ts +4 -1
- package/dist/idCapture/controller.d.ts.map +1 -1
- package/dist/idCapture/controller.js +69 -10
- package/dist/idCapture/state.d.ts +1 -3
- package/dist/idCapture/state.d.ts.map +1 -1
- package/dist/idCapture/submit.d.ts.map +1 -1
- package/dist/idCapture/submit.js +35 -1
- package/dist/idCapture/types.d.ts +2 -0
- package/dist/idCapture/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/liveness/challengeGeometry.d.ts +48 -17
- package/dist/liveness/challengeGeometry.d.ts.map +1 -1
- package/dist/liveness/challengeGeometry.js +101 -54
- package/dist/models/DocumentDetection.d.ts.map +1 -1
- package/dist/models/DocumentDetection.js +38 -2
- package/dist/models/defaults/DocumentDetectorLiteRT.d.ts +2 -2
- package/dist/models/defaults/DocumentDetectorLiteRT.d.ts.map +1 -1
- package/dist/models/defaults/DocumentDetectorLiteRT.js +27 -2
- package/dist/models/defaults/HandLandmarkLiteRT.d.ts +3 -0
- package/dist/models/defaults/HandLandmarkLiteRT.d.ts.map +1 -0
- package/dist/models/defaults/HandLandmarkLiteRT.js +5 -0
- package/dist/models/defaults/IrisLandmarkLiteRT.d.ts +3 -0
- package/dist/models/defaults/IrisLandmarkLiteRT.d.ts.map +1 -0
- package/dist/models/defaults/IrisLandmarkLiteRT.js +5 -0
- package/dist/models/defaults/PalmDetectionLiteRT.d.ts +3 -0
- package/dist/models/defaults/PalmDetectionLiteRT.d.ts.map +1 -0
- package/dist/models/defaults/PalmDetectionLiteRT.js +5 -0
- package/dist/models/defaults/PoaDocumentDetectorLiteRT.d.ts +2 -2
- package/dist/models/defaults/PoaDocumentDetectorLiteRT.d.ts.map +1 -1
- package/dist/models/defaults/PoaDocumentDetectorLiteRT.js +12 -8
- package/dist/models/defaults/index.d.ts +10 -1
- package/dist/models/defaults/index.d.ts.map +1 -1
- package/dist/models/defaults/index.js +12 -0
- package/dist/models/preloadModels.d.ts +4 -3
- package/dist/models/preloadModels.d.ts.map +1 -1
- package/dist/models/preloadModels.js +23 -3
- package/dist/models/providers/litert/FaceLandmarker.d.ts +8 -1
- package/dist/models/providers/litert/FaceLandmarker.d.ts.map +1 -1
- package/dist/models/providers/litert/FaceLandmarker.js +95 -3
- package/dist/models/providers/litert/HandOverFaceDetector.d.ts +27 -0
- package/dist/models/providers/litert/HandOverFaceDetector.d.ts.map +1 -0
- package/dist/models/providers/litert/HandOverFaceDetector.js +162 -0
- package/dist/models/providers/litert/blazeFacePrePost.js +4 -2
- package/dist/models/providers/litert/docDetectPrePost.d.ts.map +1 -1
- package/dist/models/providers/litert/docDetectPrePost.js +17 -5
- package/dist/models/providers/litert/handLandmarkPrePost.d.ts +20 -0
- package/dist/models/providers/litert/handLandmarkPrePost.d.ts.map +1 -0
- package/dist/models/providers/litert/handLandmarkPrePost.js +72 -0
- package/dist/models/providers/litert/handOverFace.d.ts +44 -0
- package/dist/models/providers/litert/handOverFace.d.ts.map +1 -0
- package/dist/models/providers/litert/handOverFace.js +139 -0
- package/dist/models/providers/litert/irisPrePost.d.ts +38 -0
- package/dist/models/providers/litert/irisPrePost.d.ts.map +1 -0
- package/dist/models/providers/litert/irisPrePost.js +101 -0
- package/dist/models/providers/litert/palmPrePost.d.ts +55 -0
- package/dist/models/providers/litert/palmPrePost.d.ts.map +1 -0
- package/dist/models/providers/litert/palmPrePost.js +151 -0
- package/dist/sdkVersions.d.ts +18 -0
- package/dist/sdkVersions.d.ts.map +1 -0
- package/dist/sdkVersions.js +8 -0
- package/dist/selfieCapture/captureQuality.d.ts +43 -0
- package/dist/selfieCapture/captureQuality.d.ts.map +1 -0
- package/dist/selfieCapture/captureQuality.js +87 -0
- package/dist/selfieCapture/challengeRunner.d.ts +9 -2
- package/dist/selfieCapture/challengeRunner.d.ts.map +1 -1
- package/dist/selfieCapture/challengeRunner.js +2 -5
- package/dist/selfieCapture/controller.d.ts +62 -1
- package/dist/selfieCapture/controller.d.ts.map +1 -1
- package/dist/selfieCapture/controller.js +470 -105
- package/dist/selfieCapture/faceTracking.d.ts +69 -1
- package/dist/selfieCapture/faceTracking.d.ts.map +1 -1
- package/dist/selfieCapture/faceTracking.js +134 -6
- package/dist/selfieCapture/guidance.d.ts +15 -0
- package/dist/selfieCapture/guidance.d.ts.map +1 -1
- package/dist/selfieCapture/guidance.js +23 -0
- package/dist/selfieCapture/index.d.ts +3 -2
- package/dist/selfieCapture/index.d.ts.map +1 -1
- package/dist/selfieCapture/index.js +1 -1
- package/dist/selfieCapture/livenessMachine.d.ts +2 -0
- package/dist/selfieCapture/livenessMachine.d.ts.map +1 -1
- package/dist/selfieCapture/livenessMachine.js +8 -0
- package/dist/selfieCapture/pipeline.d.ts +8 -0
- package/dist/selfieCapture/pipeline.d.ts.map +1 -1
- package/dist/selfieCapture/pipeline.js +2 -2
- package/dist/selfieCapture/reducer.d.ts +7 -0
- package/dist/selfieCapture/reducer.d.ts.map +1 -1
- package/dist/selfieCapture/reducer.js +45 -4
- package/dist/selfieCapture/state.d.ts +6 -0
- package/dist/selfieCapture/state.d.ts.map +1 -1
- package/dist/selfieCapture/state.js +1 -0
- package/dist/signature/frameDecode.d.ts.map +1 -1
- package/dist/signature/frameDecode.js +29 -0
- package/dist/signature/metadata.d.ts +10 -1
- package/dist/signature/metadata.d.ts.map +1 -1
- package/dist/signature/quality.d.ts +14 -6
- package/dist/signature/quality.d.ts.map +1 -1
- package/dist/signature/quality.js +13 -4
- package/dist/signatureCapture/controller.d.ts +2 -1
- package/dist/signatureCapture/controller.d.ts.map +1 -1
- package/dist/signatureCapture/controller.js +47 -2
- package/dist/signatureCapture/pipeline.d.ts.map +1 -1
- package/dist/signatureCapture/pipeline.js +6 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +10 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA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M,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;IACxE,UAAU,EAAE;QACV,eAAe,EAAE,MAAM,CAAA;QACvB,kBAAkB,EAAE,MAAM,CAAA;QAC1B,oBAAoB,EAAE,MAAM,CAAA;QAC5B,sBAAsB,EAAE,MAAM,CAAA;QAC9B,yBAAyB,EAAE;YACzB,kBAAkB,EAAE;gBAClB,cAAc,EAAE,MAAM,CAAA;gBACtB,iBAAiB,EAAE,MAAM,CAAA;aAC1B,CAAA;SACF,CAAA;QACD,SAAS,EAAE,MAAM,CAAA;QACjB,WAAW,EAAE,MAAM,GAAG,OAAO,CAAA;QAC7B,gBAAgB,EAAE,MAAM,CAAA;QACxB,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAA;QAC1B,aAAa,EAAE,MAAM,CAAA;QACrB,YAAY,EAAE,MAAM,GAAG,OAAO,CAAA;QAC9B,iBAAiB,EAAE,MAAM,CAAA;QACzB,SAAS,EAAE,MAAM,GAAG,OAAO,CAAA;QAC3B,cAAc,EAAE,MAAM,CAAA;QACtB,YAAY,EAAE,MAAM,CAAA;QACpB,aAAa,CAAC,EAAE,MAAM,CAAA;KACvB,CAAA;IACD,cAAc,EAAE;QACd,qBAAqB,EAAE,MAAM,GAAG,OAAO,CAAA;KACxC,CAAA;CACF,CAAA"}
|
|
@@ -2,6 +2,8 @@ export type SessionIo = {
|
|
|
2
2
|
fetch?: typeof fetch;
|
|
3
3
|
delay?: (ms: number) => Promise<void>;
|
|
4
4
|
ingestNonce?: (nonce?: string) => void;
|
|
5
|
+
/** Per-attempt timeout. Defaults to 10 s. */
|
|
6
|
+
attemptTimeoutMs?: number;
|
|
5
7
|
};
|
|
6
8
|
export declare function validateSession(authUrl: string, sessionId: string, io?: SessionIo): Promise<boolean>;
|
|
7
9
|
//# sourceMappingURL=validateSession.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateSession.d.ts","sourceRoot":"","sources":["../../src/client/validateSession.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validateSession.d.ts","sourceRoot":"","sources":["../../src/client/validateSession.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;IACpB,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,6CAA6C;IAC7C,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,CAAA;AAgFD,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,EAAE,GAAE,SAAc,GACjB,OAAO,CAAC,OAAO,CAAC,CAoClB"}
|
|
@@ -1,34 +1,62 @@
|
|
|
1
1
|
import { SessionValidationFailedError } from './errors';
|
|
2
2
|
import { ingestSessionAttestation } from '../attestation/attestationState';
|
|
3
3
|
import { warn } from '../utils/logger';
|
|
4
|
+
/** ValidateSession is a tiny POST that normally answers in well under a
|
|
5
|
+
* second; an attempt still pending after this is treated as a network failure
|
|
6
|
+
* (and retried) rather than waited on. */
|
|
7
|
+
const VALIDATE_SESSION_ATTEMPT_TIMEOUT_MS = 10_000;
|
|
8
|
+
// 3 retries = 4 attempts over 1 + 2 + 4 = 7 s of backoff.
|
|
9
|
+
const MAX_RETRIES = 3;
|
|
10
|
+
const BASE_DELAY_MS = 1000;
|
|
4
11
|
const realDelay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
12
|
+
/** Statuses a retry could change: a timeout, rate limiting, or a server-side
|
|
13
|
+
* fault. Any other 4xx (401, 403, 404…) is a verdict on this request and
|
|
14
|
+
* would answer the same way every time. */
|
|
15
|
+
const isTransientStatus = (status) => status === 408 || status === 429 || status >= 500;
|
|
16
|
+
async function fetchAttempt(url, init, io) {
|
|
17
|
+
const controller = new AbortController();
|
|
18
|
+
const timer = setTimeout(() => controller.abort(), io.attemptTimeoutMs);
|
|
8
19
|
try {
|
|
9
|
-
const response = await io.fetch(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
// If the request was successful or we've hit max retries, return the response
|
|
15
|
-
if (response.ok || retryCount >= maxRetries) {
|
|
16
|
-
return response;
|
|
17
|
-
}
|
|
18
|
-
// If we get here, the request failed and we should retry
|
|
19
|
-
const delay = baseDelay * Math.pow(2, retryCount); // Exponential backoff
|
|
20
|
-
await io.delay(delay);
|
|
21
|
-
return makeValidateSessionRequest(authUrl, sessionId, io, retryCount + 1);
|
|
20
|
+
const response = await io.fetch(url, { ...init, signal: controller.signal });
|
|
21
|
+
// The body is read under the same timeout: headers can arrive and the
|
|
22
|
+
// body still stall, which would otherwise hang the caller's read forever.
|
|
23
|
+
const text = await response.text();
|
|
24
|
+
return { ok: response.ok, status: response.status, text };
|
|
22
25
|
}
|
|
23
26
|
catch (error) {
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
// A bare AbortError reads "signal is aborted without reason" — name the
|
|
28
|
+
// actual failure, since this message reaches the session error overlay.
|
|
29
|
+
if (controller.signal.aborted) {
|
|
30
|
+
throw new Error(`Session validation timed out after ${io.attemptTimeoutMs} ms`);
|
|
31
|
+
}
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
clearTimeout(timer);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async function makeValidateSessionRequest(authUrl, sessionId, io) {
|
|
39
|
+
for (let retryCount = 0;; retryCount++) {
|
|
40
|
+
const lastAttempt = retryCount >= MAX_RETRIES;
|
|
41
|
+
try {
|
|
42
|
+
const response = await fetchAttempt(`${authUrl}/portal.sessions.v1.SessionsService/ValidateSession`, {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
headers: { 'Content-Type': 'application/json' },
|
|
45
|
+
body: JSON.stringify({ id: sessionId }),
|
|
46
|
+
}, io);
|
|
47
|
+
// Return anything a retry can't change: success, the last attempt, or a
|
|
48
|
+
// non-transient rejection (validateSession turns the latter two into a
|
|
49
|
+
// SessionValidationFailedError).
|
|
50
|
+
if (response.ok || lastAttempt || !isTransientStatus(response.status)) {
|
|
51
|
+
return response;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
// Network failures and timeouts are always worth another attempt.
|
|
56
|
+
if (lastAttempt)
|
|
57
|
+
throw error;
|
|
27
58
|
}
|
|
28
|
-
|
|
29
|
-
const delay = baseDelay * Math.pow(2, retryCount);
|
|
30
|
-
await io.delay(delay);
|
|
31
|
-
return makeValidateSessionRequest(authUrl, sessionId, io, retryCount + 1);
|
|
59
|
+
await io.delay(BASE_DELAY_MS * 2 ** retryCount);
|
|
32
60
|
}
|
|
33
61
|
}
|
|
34
62
|
export async function validateSession(authUrl, sessionId, io = {}) {
|
|
@@ -42,9 +70,10 @@ export async function validateSession(authUrl, sessionId, io = {}) {
|
|
|
42
70
|
fetch: io.fetch ?? globalThis.fetch.bind(globalThis),
|
|
43
71
|
delay: io.delay ?? realDelay,
|
|
44
72
|
ingestNonce: io.ingestNonce ?? ingestSessionAttestation,
|
|
73
|
+
attemptTimeoutMs: io.attemptTimeoutMs ?? VALIDATE_SESSION_ATTEMPT_TIMEOUT_MS,
|
|
45
74
|
};
|
|
46
75
|
const resp = await makeValidateSessionRequest(authUrl, sessionId, resolvedIo);
|
|
47
|
-
const respText =
|
|
76
|
+
const respText = resp.text;
|
|
48
77
|
let message = respText;
|
|
49
78
|
let valid = false;
|
|
50
79
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoCaptureEngine.d.ts","sourceRoot":"","sources":["../../src/documentCapture/autoCaptureEngine.ts"],"names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UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,aAAa,EAAE,CAAC,WAAW,EAAE,sBAAsB,KAAK,IAAI,CAAA;IAC5D,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAA;IAC1D,uCAAuC;IACvC,EAAE,CAAC,EAAE;QACH,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;QAClB,YAAY,CAAC,EAAE,MAAM,iBAAiB,CAAA;QACtC,eAAe,CAAC,EAAE,OAAO,eAAe,CAAA;QACxC,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAA;KACzB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,cAAc,CAAA;IACrB,gBAAgB,EAAE,MAAM,CAAA;IACxB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,4DAA4D;IAC5D,KAAK,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACpC,IAAI,IAAI,IAAI,CAAA;IACZ;;;;;;;;;;;;;;;;OAgBG;IACH,cAAc,IAAI,iBAAiB,GAAG,IAAI,CAAA;IAC1C;;;;;;;;;;;;;OAaG;IACH,yBAAyB,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAAA;IAC5C;;;OAGG;IACH,iBAAiB,IAAI,sBAAsB,EAAE,CAAA;IAC7C,mBAAmB,IAAI,IAAI,CAAA;CAC5B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,MAAM,CAAA;AAK1C,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,uBAAuB,GAC9B,iBAAiB,CAkenB"}
|
|
@@ -33,7 +33,7 @@ import { runModelLoadLifecycle } from '../models/modelLifecycle';
|
|
|
33
33
|
import { resolveRuntime } from '../models/runtimeSelection';
|
|
34
34
|
import { isMobile } from '../utils/isMobile';
|
|
35
35
|
import { warn } from '../utils/logger';
|
|
36
|
-
import { computePoaFillWindow, computeGuideRect, computePoaFraming, failingPoaGates, isAutoCaptureSatisfied, peakScoresByLabel, selectPoaTarget, } from './autoCaptureGeometry';
|
|
36
|
+
import { computePoaFillWindow, computeGuideRect, computePoaFraming, touchesFrameEdge, failingPoaGates, isAutoCaptureSatisfied, peakScoresByLabel, selectPoaTarget, } from './autoCaptureGeometry';
|
|
37
37
|
import { advancePoaGuidance, createPoaGuidanceState, poaGuidanceCode, poaGuidanceDiagnostics, } from './autoCaptureGuidance';
|
|
38
38
|
import { resolveAutoCapture, } from './autoCaptureOptions';
|
|
39
39
|
/**
|
|
@@ -94,10 +94,14 @@ export function createAutoCaptureEngine(config) {
|
|
|
94
94
|
// Stability window. Local to this engine — see the header on why the shared
|
|
95
95
|
// module-level trackers are not reused.
|
|
96
96
|
let boxWindow = [];
|
|
97
|
-
// Newest first, same length as `boxWindow`. Held as
|
|
97
|
+
// Newest first, same length as `boxWindow`. Held as readings rather than
|
|
98
98
|
// recomputed from `boxWindow` because the frame dimensions a reading was
|
|
99
99
|
// taken against are not carried on the box, and a resolution change
|
|
100
100
|
// mid-window would silently re-scale the older entries.
|
|
101
|
+
//
|
|
102
|
+
// `fill` and frame-edge contact live in ONE window rather than two parallel
|
|
103
|
+
// ones, so they cannot be cleared at different times: a contact surviving a
|
|
104
|
+
// reset would reject a sheet for where it was before it left frame.
|
|
101
105
|
let fillWindow = [];
|
|
102
106
|
let frameIntervals = [];
|
|
103
107
|
let lastFrameAt = 0;
|
|
@@ -204,14 +208,14 @@ export function createAutoCaptureEngine(config) {
|
|
|
204
208
|
worstIou >= stabilityThreshold,
|
|
205
209
|
};
|
|
206
210
|
}
|
|
207
|
-
/** Push this frame's
|
|
208
|
-
function trackFill(
|
|
209
|
-
if (
|
|
211
|
+
/** Push this frame's reading and report #343's aggregate window. */
|
|
212
|
+
function trackFill(reading) {
|
|
213
|
+
if (reading === null)
|
|
210
214
|
return computePoaFillWindow([], fillWindowOptions);
|
|
211
|
-
fillWindow.unshift(
|
|
215
|
+
fillWindow.unshift(reading);
|
|
212
216
|
if (fillWindow.length > stabilityFrames)
|
|
213
217
|
fillWindow.length = stabilityFrames;
|
|
214
|
-
return computePoaFillWindow(fillWindow, fillWindowOptions);
|
|
218
|
+
return computePoaFillWindow(fillWindow.map((entry) => entry.fill), fillWindowOptions, fillWindow.map((entry) => entry.touchesFrameEdge), fillWindow.map((entry) => entry.frameFill));
|
|
215
219
|
}
|
|
216
220
|
async function measureFocus(box) {
|
|
217
221
|
if (focusState !== 'ready' || !video || !box)
|
|
@@ -285,7 +289,22 @@ export function createAutoCaptureEngine(config) {
|
|
|
285
289
|
const framing = target ? computePoaFraming(target.box, guideRect) : null;
|
|
286
290
|
const stability = trackStability(target?.box ?? null);
|
|
287
291
|
// AFTER trackStability, which clears both windows when the box is lost.
|
|
288
|
-
const fillWindowReading = trackFill(
|
|
292
|
+
const fillWindowReading = trackFill(target && framing
|
|
293
|
+
? {
|
|
294
|
+
fill: framing.fill,
|
|
295
|
+
// Against the CAMERA frame, which is what gets saved: "too close"
|
|
296
|
+
// is about the whole picture, not the box the applicant aims at.
|
|
297
|
+
frameFill: computePoaFraming(target.box, {
|
|
298
|
+
x: 0,
|
|
299
|
+
y: 0,
|
|
300
|
+
width: prediction.frameWidth,
|
|
301
|
+
height: prediction.frameHeight,
|
|
302
|
+
}).fill,
|
|
303
|
+
// Against the CAMERA frame, not the guide rect: the question is
|
|
304
|
+
// whether paper runs past what the camera can see.
|
|
305
|
+
touchesFrameEdge: touchesFrameEdge(target.box, prediction.frameWidth, prediction.frameHeight),
|
|
306
|
+
}
|
|
307
|
+
: null);
|
|
289
308
|
// FOCUS RUNS LAST, AND ONLY IF EVERYTHING ELSE ALREADY PASSED.
|
|
290
309
|
//
|
|
291
310
|
// Borrowed from `idCapture`, whose focus prediction lives inside the
|
|
@@ -4,6 +4,25 @@ import type { PoaGuidanceDiagnostics } from './autoCaptureGuidance';
|
|
|
4
4
|
* The two-sided window on `fill`, seeded by #343 and fixed by #380 on real
|
|
5
5
|
* frames.
|
|
6
6
|
*
|
|
7
|
+
* THE TWO SIDES NOW MEASURE AGAINST DIFFERENT RECTANGLES. `FILL_MIN` is still
|
|
8
|
+
* taken against the GUIDE RECT: it asks whether the page is big enough to read,
|
|
9
|
+
* relative to the box the applicant was asked to fill. `FILL_MAX` is taken
|
|
10
|
+
* against the whole CAMERA FRAME, because the saved image is the whole frame
|
|
11
|
+
* (see `defaultCaptureFrame` in controller.ts). Against the guide it forced the
|
|
12
|
+
* page to fit inside the A4 box — on a 16:9 webcam a column ~40% of the width —
|
|
13
|
+
* though everything around the box is saved too.
|
|
14
|
+
*
|
|
15
|
+
* It is not redundant with `touchesFrameEdge`, and the proof is the two live
|
|
16
|
+
* desktop captures below: pages clipped top and bottom whose boxes stop 0.87%
|
|
17
|
+
* SHORT of the frame edges, so the clamp never fires. Camera-relative they read
|
|
18
|
+
* 0.983. The re-seated 0.975 sits between those and the largest camera-relative
|
|
19
|
+
* fill any frame reaches while clearing every other check on the saved device
|
|
20
|
+
* recordings (0.974 of 270), so it keeps rejecting the clips and costs no
|
|
21
|
+
* capture there. That gap is ~0.01 wide, like #380's — an operating point, not
|
|
22
|
+
* a separation.
|
|
23
|
+
*
|
|
24
|
+
* The #380 notes below describe the guide-relative 0.99 it replaces.
|
|
25
|
+
*
|
|
7
26
|
* `FILL_MAX` is the anti-crop gate: a capture zoomed into the address block has
|
|
8
27
|
* paper edge to edge, so its fill runs to ~1.0 while a complete sheet on
|
|
9
28
|
* #343's ground truth reads 0.720-0.974. `FILL_MAX` also has to absorb the skew
|
|
@@ -40,7 +59,7 @@ import type { PoaGuidanceDiagnostics } from './autoCaptureGuidance';
|
|
|
40
59
|
* skew budget #343 estimated at 0.03-0.05 is still UNMEASURED, which matters
|
|
41
60
|
* because FILL_MAX has only 3.7% margin and tilt eats exactly that.
|
|
42
61
|
*/
|
|
43
|
-
export declare const POA_FILL_MAX = 0.
|
|
62
|
+
export declare const POA_FILL_MAX = 0.975;
|
|
44
63
|
export declare const POA_FILL_MIN = 0.7;
|
|
45
64
|
/**
|
|
46
65
|
* Focus floor, seeded by #344 in a POA-SPECIFIC slot rather than reusing
|
|
@@ -123,9 +142,11 @@ type DetectedObjectLike = {
|
|
|
123
142
|
* Every gate the loop can fail, in the provisional precedence order the
|
|
124
143
|
* overlay renders them in.
|
|
125
144
|
*
|
|
126
|
-
* `tooClose`
|
|
127
|
-
*
|
|
128
|
-
*
|
|
145
|
+
* `tooClose` leads because "move back" is what the AMEX failure needs. It and
|
|
146
|
+
* `tooFar` are the two sides of #343's one window, and on `fill` alone they
|
|
147
|
+
* cannot both fire — but frame-edge contact can put a small sliver of sheet in
|
|
148
|
+
* both at once. `tooClose` winning is then the correct instruction: moving
|
|
149
|
+
* closer cannot bring paper that is off the frame back into view. Stability and focus sit last because they are meaningless until the
|
|
129
150
|
* sheet is framed — and #344 made `outOfFocus`-last a REQUIREMENT rather than
|
|
130
151
|
* a preference: focus is only computed on a frame that already has a box, and
|
|
131
152
|
* the score is non-monotonic, recovering at severe blur.
|
|
@@ -222,6 +243,41 @@ export declare function computeGuideRect(frameWidth: number, frameHeight: number
|
|
|
222
243
|
* trip `FILL_MAX` instead of quietly passing.
|
|
223
244
|
*/
|
|
224
245
|
export declare function computePoaFraming(box: DetectedObjectBox, rect: FrameRect): PoaFraming;
|
|
246
|
+
/**
|
|
247
|
+
* How close to a camera-frame edge a box coordinate may sit and still count as
|
|
248
|
+
* touching it, as a fraction of that axis.
|
|
249
|
+
*
|
|
250
|
+
* FLOAT SAFETY, NOT A TUNING KNOB. The LiteRT decoder clamps every coordinate
|
|
251
|
+
* to the frame, so a box over paper that continues past the edge lands on the
|
|
252
|
+
* edge EXACTLY; this only absorbs rounding. It is about a pixel on a 1080-wide
|
|
253
|
+
* frame.
|
|
254
|
+
*
|
|
255
|
+
* Deliberately not widened to a box-encoding grid step. On the five saved
|
|
256
|
+
* #380-era device recordings, frames passing today's gate go from 66 rejected
|
|
257
|
+
* at the exact clamp to 134 at one grid step — and every one of the extra 68 is
|
|
258
|
+
* a sheet whose edge IS inside the frame, which is friction with nothing bought.
|
|
259
|
+
*/
|
|
260
|
+
export declare const POA_FRAME_EDGE_EPSILON = 0.001;
|
|
261
|
+
/**
|
|
262
|
+
* Whether a detection box touches an edge of the CAMERA frame — the paper
|
|
263
|
+
* continues past what the camera can see.
|
|
264
|
+
*
|
|
265
|
+
* `fill` cannot see this. It measures how big the box is, and a sheet slid
|
|
266
|
+
* sideways off the frame just produces a narrower box: the detector clamps to
|
|
267
|
+
* the frame, and on a portrait phone an A4 guide spans the camera's full width,
|
|
268
|
+
* so on that axis `fillW` can never exceed 1.0 however much paper is hidden.
|
|
269
|
+
* `max(fillW, fillH)` then hands the verdict to the other axis. Replayed
|
|
270
|
+
* through the gate, a sheet with HALF its width off the frame read `fill 0.90`
|
|
271
|
+
* and captured — which is what demo testers reported, and what #380's crop
|
|
272
|
+
* recording never exercised: it zoomed in on the address block, putting paper
|
|
273
|
+
* edge to edge on both axes.
|
|
274
|
+
*
|
|
275
|
+
* Not the per-edge margin gate #343 deleted. That measured distance to the
|
|
276
|
+
* GUIDE rect, where the complete-vs-clipped separation was a third of a grid
|
|
277
|
+
* step and drowned in quantization. This asks a yes/no question the decoder's
|
|
278
|
+
* clamp answers exactly — the box is on the frame edge or it is not.
|
|
279
|
+
*/
|
|
280
|
+
export declare function touchesFrameEdge(box: DetectedObjectBox, frameWidth: number, frameHeight: number): boolean;
|
|
225
281
|
/**
|
|
226
282
|
* #343's gate: one two-sided window on `fill`, read on an AGGREGATE rather
|
|
227
283
|
* than on the instantaneous frame.
|
|
@@ -239,8 +295,17 @@ export declare function computePoaFraming(box: DetectedObjectBox, rect: FrameRec
|
|
|
239
295
|
* how far `instant` actually roams on real handheld video.
|
|
240
296
|
*/
|
|
241
297
|
export type PoaFillWindow = {
|
|
242
|
-
/**
|
|
298
|
+
/**
|
|
299
|
+
* Mean `fill` against the GUIDE RECT across the window — what `fillMin` is
|
|
300
|
+
* compared with.
|
|
301
|
+
*/
|
|
243
302
|
mean: number;
|
|
303
|
+
/**
|
|
304
|
+
* Mean `fill` against the CAMERA FRAME across the window — what `fillMax` is
|
|
305
|
+
* compared with, because the saved image is the whole frame. Optional so a
|
|
306
|
+
* hand-built window still type-checks; absent reads as `mean`.
|
|
307
|
+
*/
|
|
308
|
+
frameMean?: number;
|
|
244
309
|
/** This frame's `fill`, before aggregation. */
|
|
245
310
|
instant: number;
|
|
246
311
|
min: number;
|
|
@@ -252,7 +317,22 @@ export type PoaFillWindow = {
|
|
|
252
317
|
/** In-force constants, carried so the overlay never has to guess them. */
|
|
253
318
|
fillMin: number;
|
|
254
319
|
fillMax: number;
|
|
255
|
-
/**
|
|
320
|
+
/**
|
|
321
|
+
* Some box in the window touched a camera-frame edge — see
|
|
322
|
+
* `touchesFrameEdge`. Reported on its own so a `tooClose` with `fill` in
|
|
323
|
+
* range is explained rather than looking like a wrong threshold.
|
|
324
|
+
*
|
|
325
|
+
* OPTIONAL even though `computePoaFillWindow` always sets it, for the same
|
|
326
|
+
* reason as `captureMetadata` in state.ts: this type ships from the public
|
|
327
|
+
* `documentCapture` entry, building one is a supported consumer pattern
|
|
328
|
+
* (fixtures, mocked diagnostics), and a required field would break every
|
|
329
|
+
* such literal in a patch release. Read absent as `false`.
|
|
330
|
+
*/
|
|
331
|
+
frameEdgeContact?: boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Cropped — the AMEX failure. Move back. Either the sheet is bigger than the
|
|
334
|
+
* guide (`mean > fillMax`) or it runs off the frame (`frameEdgeContact`).
|
|
335
|
+
*/
|
|
256
336
|
tooClose: boolean;
|
|
257
337
|
/** Too far away, or below the detection floor. Move closer. */
|
|
258
338
|
tooFar: boolean;
|
|
@@ -274,8 +354,18 @@ export type PoaFillWindowOptions = {
|
|
|
274
354
|
* for a full window: the window fills in under a second, and `notStable`
|
|
275
355
|
* already holds the capture until the IoU window is complete, so a second
|
|
276
356
|
* "not enough frames" state would only be a way for the two to disagree.
|
|
357
|
+
*
|
|
358
|
+
* `edgeContacts` is `touchesFrameEdge` per frame, same order and same window.
|
|
359
|
+
* ANY contact in the window trips `tooClose`, not just this frame's: on the
|
|
360
|
+
* saved device recordings contact flickers, with 15 frames that miss the edge
|
|
361
|
+
* sitting inside contact episodes. A per-frame check would let a crop through
|
|
362
|
+
* on exactly those frames, and the burst window would bank one.
|
|
363
|
+
*
|
|
364
|
+
* `frameFills` is `fill` measured against the camera frame, same order and
|
|
365
|
+
* window; `fillMax` is compared with its mean. It defaults to `fills`, which is
|
|
366
|
+
* exact whenever the guide rect is the whole frame.
|
|
277
367
|
*/
|
|
278
|
-
export declare function computePoaFillWindow(fills: readonly number[], options: PoaFillWindowOptions): PoaFillWindow;
|
|
368
|
+
export declare function computePoaFillWindow(fills: readonly number[], options: PoaFillWindowOptions, edgeContacts?: readonly boolean[], frameFills?: readonly number[]): PoaFillWindow;
|
|
279
369
|
/**
|
|
280
370
|
* Peak score per emitted label.
|
|
281
371
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoCaptureGeometry.d.ts","sourceRoot":"","sources":["../../src/documentCapture/autoCaptureGeometry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"autoCaptureGeometry.d.ts","sourceRoot":"","sources":["../../src/documentCapture/autoCaptureGeometry.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EAClB,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,eAAO,MAAM,YAAY,QAAQ,CAAA;AACjC,eAAO,MAAM,YAAY,MAAM,CAAA;AAC/B;;;;;;;;;;;;;;GAcG;AACH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SIDES NOW MEASURE AGAINST DIFFERENT RECTANGLES. `FILL_MIN` is still
|
|
6
|
+
* taken against the GUIDE RECT: it asks whether the page is big enough to read,
|
|
7
|
+
* relative to the box the applicant was asked to fill. `FILL_MAX` is taken
|
|
8
|
+
* against the whole CAMERA FRAME, because the saved image is the whole frame
|
|
9
|
+
* (see `defaultCaptureFrame` in controller.ts). Against the guide it forced the
|
|
10
|
+
* page to fit inside the A4 box — on a 16:9 webcam a column ~40% of the width —
|
|
11
|
+
* though everything around the box is saved too.
|
|
12
|
+
*
|
|
13
|
+
* It is not redundant with `touchesFrameEdge`, and the proof is the two live
|
|
14
|
+
* desktop captures below: pages clipped top and bottom whose boxes stop 0.87%
|
|
15
|
+
* SHORT of the frame edges, so the clamp never fires. Camera-relative they read
|
|
16
|
+
* 0.983. The re-seated 0.975 sits between those and the largest camera-relative
|
|
17
|
+
* fill any frame reaches while clearing every other check on the saved device
|
|
18
|
+
* recordings (0.974 of 270), so it keeps rejecting the clips and costs no
|
|
19
|
+
* capture there. That gap is ~0.01 wide, like #380's — an operating point, not
|
|
20
|
+
* a separation.
|
|
21
|
+
*
|
|
22
|
+
* The #380 notes below describe the guide-relative 0.99 it replaces.
|
|
23
|
+
*
|
|
5
24
|
* `FILL_MAX` is the anti-crop gate: a capture zoomed into the address block has
|
|
6
25
|
* paper edge to edge, so its fill runs to ~1.0 while a complete sheet on
|
|
7
26
|
* #343's ground truth reads 0.720-0.974. `FILL_MAX` also has to absorb the skew
|
|
@@ -38,7 +57,7 @@
|
|
|
38
57
|
* skew budget #343 estimated at 0.03-0.05 is still UNMEASURED, which matters
|
|
39
58
|
* because FILL_MAX has only 3.7% margin and tilt eats exactly that.
|
|
40
59
|
*/
|
|
41
|
-
export const POA_FILL_MAX = 0.
|
|
60
|
+
export const POA_FILL_MAX = 0.975;
|
|
42
61
|
export const POA_FILL_MIN = 0.7;
|
|
43
62
|
/**
|
|
44
63
|
* Focus floor, seeded by #344 in a POA-SPECIFIC slot rather than reusing
|
|
@@ -117,9 +136,11 @@ export const POA_TARGET_LABELS = [
|
|
|
117
136
|
* Every gate the loop can fail, in the provisional precedence order the
|
|
118
137
|
* overlay renders them in.
|
|
119
138
|
*
|
|
120
|
-
* `tooClose`
|
|
121
|
-
*
|
|
122
|
-
*
|
|
139
|
+
* `tooClose` leads because "move back" is what the AMEX failure needs. It and
|
|
140
|
+
* `tooFar` are the two sides of #343's one window, and on `fill` alone they
|
|
141
|
+
* cannot both fire — but frame-edge contact can put a small sliver of sheet in
|
|
142
|
+
* both at once. `tooClose` winning is then the correct instruction: moving
|
|
143
|
+
* closer cannot bring paper that is off the frame back into view. Stability and focus sit last because they are meaningless until the
|
|
123
144
|
* sheet is framed — and #344 made `outOfFocus`-last a REQUIREMENT rather than
|
|
124
145
|
* a preference: focus is only computed on a frame that already has a box, and
|
|
125
146
|
* the score is non-monotonic, recovering at severe blur.
|
|
@@ -236,6 +257,48 @@ export function computePoaFraming(box, rect) {
|
|
|
236
257
|
fillHeight,
|
|
237
258
|
};
|
|
238
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* How close to a camera-frame edge a box coordinate may sit and still count as
|
|
262
|
+
* touching it, as a fraction of that axis.
|
|
263
|
+
*
|
|
264
|
+
* FLOAT SAFETY, NOT A TUNING KNOB. The LiteRT decoder clamps every coordinate
|
|
265
|
+
* to the frame, so a box over paper that continues past the edge lands on the
|
|
266
|
+
* edge EXACTLY; this only absorbs rounding. It is about a pixel on a 1080-wide
|
|
267
|
+
* frame.
|
|
268
|
+
*
|
|
269
|
+
* Deliberately not widened to a box-encoding grid step. On the five saved
|
|
270
|
+
* #380-era device recordings, frames passing today's gate go from 66 rejected
|
|
271
|
+
* at the exact clamp to 134 at one grid step — and every one of the extra 68 is
|
|
272
|
+
* a sheet whose edge IS inside the frame, which is friction with nothing bought.
|
|
273
|
+
*/
|
|
274
|
+
export const POA_FRAME_EDGE_EPSILON = 0.001;
|
|
275
|
+
/**
|
|
276
|
+
* Whether a detection box touches an edge of the CAMERA frame — the paper
|
|
277
|
+
* continues past what the camera can see.
|
|
278
|
+
*
|
|
279
|
+
* `fill` cannot see this. It measures how big the box is, and a sheet slid
|
|
280
|
+
* sideways off the frame just produces a narrower box: the detector clamps to
|
|
281
|
+
* the frame, and on a portrait phone an A4 guide spans the camera's full width,
|
|
282
|
+
* so on that axis `fillW` can never exceed 1.0 however much paper is hidden.
|
|
283
|
+
* `max(fillW, fillH)` then hands the verdict to the other axis. Replayed
|
|
284
|
+
* through the gate, a sheet with HALF its width off the frame read `fill 0.90`
|
|
285
|
+
* and captured — which is what demo testers reported, and what #380's crop
|
|
286
|
+
* recording never exercised: it zoomed in on the address block, putting paper
|
|
287
|
+
* edge to edge on both axes.
|
|
288
|
+
*
|
|
289
|
+
* Not the per-edge margin gate #343 deleted. That measured distance to the
|
|
290
|
+
* GUIDE rect, where the complete-vs-clipped separation was a third of a grid
|
|
291
|
+
* step and drowned in quantization. This asks a yes/no question the decoder's
|
|
292
|
+
* clamp answers exactly — the box is on the frame edge or it is not.
|
|
293
|
+
*/
|
|
294
|
+
export function touchesFrameEdge(box, frameWidth, frameHeight) {
|
|
295
|
+
if (frameWidth <= 0 || frameHeight <= 0)
|
|
296
|
+
return false;
|
|
297
|
+
return (box.xMin / frameWidth <= POA_FRAME_EDGE_EPSILON ||
|
|
298
|
+
box.yMin / frameHeight <= POA_FRAME_EDGE_EPSILON ||
|
|
299
|
+
1 - box.xMax / frameWidth <= POA_FRAME_EDGE_EPSILON ||
|
|
300
|
+
1 - box.yMax / frameHeight <= POA_FRAME_EDGE_EPSILON);
|
|
301
|
+
}
|
|
239
302
|
/**
|
|
240
303
|
* Aggregate a window of `fill` readings, newest first, and take the verdict.
|
|
241
304
|
*
|
|
@@ -243,8 +306,18 @@ export function computePoaFraming(box, rect) {
|
|
|
243
306
|
* for a full window: the window fills in under a second, and `notStable`
|
|
244
307
|
* already holds the capture until the IoU window is complete, so a second
|
|
245
308
|
* "not enough frames" state would only be a way for the two to disagree.
|
|
309
|
+
*
|
|
310
|
+
* `edgeContacts` is `touchesFrameEdge` per frame, same order and same window.
|
|
311
|
+
* ANY contact in the window trips `tooClose`, not just this frame's: on the
|
|
312
|
+
* saved device recordings contact flickers, with 15 frames that miss the edge
|
|
313
|
+
* sitting inside contact episodes. A per-frame check would let a crop through
|
|
314
|
+
* on exactly those frames, and the burst window would bank one.
|
|
315
|
+
*
|
|
316
|
+
* `frameFills` is `fill` measured against the camera frame, same order and
|
|
317
|
+
* window; `fillMax` is compared with its mean. It defaults to `fills`, which is
|
|
318
|
+
* exact whenever the guide rect is the whole frame.
|
|
246
319
|
*/
|
|
247
|
-
export function computePoaFillWindow(fills, options) {
|
|
320
|
+
export function computePoaFillWindow(fills, options, edgeContacts = [], frameFills = fills) {
|
|
248
321
|
const { fillMin, fillMax } = options;
|
|
249
322
|
const framesNeeded = options.framesNeeded ?? fills.length;
|
|
250
323
|
if (fills.length === 0) {
|
|
@@ -258,6 +331,8 @@ export function computePoaFillWindow(fills, options) {
|
|
|
258
331
|
framesNeeded,
|
|
259
332
|
fillMin,
|
|
260
333
|
fillMax,
|
|
334
|
+
frameMean: 0,
|
|
335
|
+
frameEdgeContact: false,
|
|
261
336
|
// No box is the FAR end of the range, not an error state: #342 found a
|
|
262
337
|
// hard detection floor at 0.40 linear scale, past which the model emits
|
|
263
338
|
// nothing at all.
|
|
@@ -276,6 +351,10 @@ export function computePoaFillWindow(fills, options) {
|
|
|
276
351
|
max = fill;
|
|
277
352
|
}
|
|
278
353
|
const mean = sum / fills.length;
|
|
354
|
+
const frameMean = frameFills.length
|
|
355
|
+
? frameFills.reduce((total, fill) => total + fill, 0) / frameFills.length
|
|
356
|
+
: mean;
|
|
357
|
+
const frameEdgeContact = edgeContacts.some(Boolean);
|
|
279
358
|
return {
|
|
280
359
|
mean,
|
|
281
360
|
instant: fills[0],
|
|
@@ -286,7 +365,9 @@ export function computePoaFillWindow(fills, options) {
|
|
|
286
365
|
framesNeeded,
|
|
287
366
|
fillMin,
|
|
288
367
|
fillMax,
|
|
289
|
-
|
|
368
|
+
frameMean,
|
|
369
|
+
frameEdgeContact,
|
|
370
|
+
tooClose: frameMean > fillMax || frameEdgeContact,
|
|
290
371
|
tooFar: mean < fillMin,
|
|
291
372
|
};
|
|
292
373
|
}
|
|
@@ -73,7 +73,12 @@ export type DocumentCaptureAttemptMetadata = {
|
|
|
73
73
|
bestFocusScore: number | null;
|
|
74
74
|
/** Detection scores of the discarded attempts, oldest first. */
|
|
75
75
|
discardedDetectionScores: number[];
|
|
76
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* The accepted frame's box, in fractions of the GUIDE RECT — the box the
|
|
78
|
+
* applicant was asked to fill — like `framing`. Not the submitted image,
|
|
79
|
+
* which is the whole camera frame: a sheet that spilled past the guide reads
|
|
80
|
+
* below 0 or above 1 here while being entirely inside the picture.
|
|
81
|
+
*/
|
|
77
82
|
boundingBox: {
|
|
78
83
|
xMin: number;
|
|
79
84
|
yMin: number;
|
|
@@ -81,9 +86,12 @@ export type DocumentCaptureAttemptMetadata = {
|
|
|
81
86
|
yMax: number;
|
|
82
87
|
} | null;
|
|
83
88
|
/**
|
|
84
|
-
* Framing at the accepted frame
|
|
85
|
-
*
|
|
86
|
-
*
|
|
89
|
+
* Framing at the accepted frame, measured against the GUIDE RECT — the box
|
|
90
|
+
* the applicant was asked to fill — not the submitted image. Margins are
|
|
91
|
+
* READINGS, not verdicts — #343 deleted the margin gate — and are carried so
|
|
92
|
+
* a later question about which axis bound is answerable without a new SDK
|
|
93
|
+
* release. A negative margin means the sheet spilled past the guide, which
|
|
94
|
+
* the full-frame image still contains.
|
|
87
95
|
*/
|
|
88
96
|
framing: {
|
|
89
97
|
fill: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoCaptureMetadata.d.ts","sourceRoot":"","sources":["../../src/documentCapture/autoCaptureMetadata.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB;AAC3B,4CAA4C;AAC1C,SAAS;AACX,6CAA6C;GAC3C,uBAAuB;AACzB,uCAAuC;GACrC,eAAe;AACjB,kEAAkE;GAChE,gBAAgB;AAClB,6DAA6D;GAC3D,mBAAmB;AACrB,gFAAgF;GAC9E,0BAA0B;AAC5B,oEAAoE;GAClE,kBAAkB,CAAA;AAEtB;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,8EAA8E;IAC9E,CAAC,EAAE,CAAC,CAAA;IACJ,WAAW,EAAE,mBAAmB,CAAA;IAChC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC;;;;;;;;;OASG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,uDAAuD;IACvD,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,qDAAqD;IACrD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,sEAAsE;IACtE,cAAc,EAAE,MAAM,CAAA;IACtB,iEAAiE;IACjE,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,gEAAgE;IAChE,wBAAwB,EAAE,MAAM,EAAE,CAAA;IAClC
|
|
1
|
+
{"version":3,"file":"autoCaptureMetadata.d.ts","sourceRoot":"","sources":["../../src/documentCapture/autoCaptureMetadata.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB;AAC3B,4CAA4C;AAC1C,SAAS;AACX,6CAA6C;GAC3C,uBAAuB;AACzB,uCAAuC;GACrC,eAAe;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DE RECT
|
|
141
|
-
* the box describes the image the backend actually receives.
|
|
140
|
+
* Fractions of the GUIDE RECT.
|
|
142
141
|
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
142
|
+
* Chosen while captures were cropped to the guide rect, so that the box
|
|
143
|
+
* described the image the backend received. The crop is gone — the saved image
|
|
144
|
+
* is the whole frame — but the field keeps its reference frame: it is public,
|
|
145
|
+
* it reaches every capture callback and the backend's `filemetadata` reader,
|
|
146
|
+
* and changing what an existing number is measured against is a silent break
|
|
147
|
+
* for anyone already reading it. It now pairs with `framing` as the gate's view
|
|
148
|
+
* of the sheet rather than as coordinates into the picture.
|
|
146
149
|
*/
|
|
147
150
|
function normalizeBox(box, frame) {
|
|
148
151
|
const rect = frame?.guideRect;
|