@idmission/websdk-core 0.2.0 → 0.6.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 +88 -18
- package/dist/client/IdmissionClient.d.ts.map +1 -1
- package/dist/client/IdmissionClient.js +241 -105
- 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/artifacts.d.ts +20 -0
- package/dist/client/artifacts.d.ts.map +1 -1
- 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 +4 -1
- 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
|
@@ -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,eAAO,MAAM,oBAAoB;;;CAAuC,CAAA;AACxE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,aAAa,OAAO,CAAA;AA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B,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,qFAAqF;IACrF,OAAO,EAAE,MAAM,CAAA;IACf,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAA;IACnB,iFAAiF;IACjF,eAAe,EAAE,cAAc,EAAE,CAAA;IACjC,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,uEAAuE;IACvE,MAAM,EAAE,SAAS,GAAG,IAAI,CAAA;IACxB,8CAA8C;IAC9C,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,UAAU,GAAG,IAAI,CAAA;IAC1B;;;OAGG;IACH,UAAU,EAAE,aAAa,CAAA;IACzB,+CAA+C;IAC/C,KAAK,EAAE,2BAA2B,GAAG,IAAI,CAAA;IACzC,SAAS,EAAE,+BAA+B,CAAA;IAC1C,2EAA2E;IAC3E,YAAY,EAAE,OAAO,EAAE,CAAA;IACvB;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,QAAQ,EAAE,sBAAsB,CAAA;IAChC,kDAAkD;IAClD,eAAe,EAAE,MAAM,CAAA;IACvB,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAA;IACjB,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,mFAAmF;IACnF,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,SAAS,EAAE,SAAS,CAAA;CACrB,CAAA"}
|
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
* The two-sided window on `fill`, seeded by #343 and fixed by #380 on real
|
|
3
3
|
* frames.
|
|
4
4
|
*
|
|
5
|
+
* THE TWO 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;AACjB,kEAAkE;GAChE,gBAAgB;AAClB,6DAA6D;GAC3D,mBAAmB;AACrB,gFAAgF;GAC9E,0BAA0B;AAC5B,oEAAoE;GAClE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,GAAG,IAAI,CAAA;IACjC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,SAAS,EAAE,sBAAsB,GAAG,IAAI,CAAA;IACxC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,YAAY,EAAE,MAAM,CAAA;IACpB,wBAAwB,EAAE,MAAM,EAAE,CAAA;CACnC,CAAA;AAED,wBAAgB,wBAAwB,IAAI,kBAAkB,CAU7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,kBAAkB,EAC/B,KAAK,EAAE,sBAAsB,GAC5B,kBAAkB,CAepB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,WAAW,EAAE,kBAAkB,GAC9B,kBAAkB,CASpB;AAiBD,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,EAAE,mBAAmB,CAAA;IAChC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,wDAAwD;IACxD,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAA;CAC9C,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,kBAAkB,GAAG,IAAI,EACtC,OAAO,EAAE,2BAA2B,GACnC,8BAA8B,CAiDhC;AA8BD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,0BAA0B,MAAM,CAAA;AAK7C,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,8BAA8B,GACvC,MAAM,CAcR"}
|
|
@@ -137,12 +137,15 @@ export function buildAttemptMetadata(accumulator, options) {
|
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
|
-
* Fractions of the GUIDE 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;
|
|
@@ -113,11 +113,10 @@ export declare const DEFAULT_MANUAL_FALLBACK_AFTER_MS = 30000;
|
|
|
113
113
|
/**
|
|
114
114
|
* Camera width worth requesting for auto-capture, as a RECOMMENDATION.
|
|
115
115
|
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* guide on 2560 is 1018x1440.
|
|
116
|
+
* An A4 page filling the portrait guide on the default 1920-wide 16:9 stream
|
|
117
|
+
* spans about 764x1080 pixels, so it lands near 90 DPI — 6pt print about two
|
|
118
|
+
* pixels tall. That is a sampling limit, not blur, and no focus threshold
|
|
119
|
+
* recovers it. The same page on 2560 is about 1018x1440.
|
|
121
120
|
*
|
|
122
121
|
* NOT APPLIED AUTOMATICALLY, and that is the finding rather than an oversight.
|
|
123
122
|
* It was, briefly, and it made captures materially harder to land: the loop
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoCaptureOptions.d.ts","sourceRoot":"","sources":["../../src/documentCapture/autoCaptureOptions.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAS1E;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAA;IACf,6EAA6E;IAC7E,OAAO,EAAE,MA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ChB,eAAe,EAAE,MAAM,CAAA;IACvB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,UAAU,EAAE,6BAA6B,CAAA;IACzC,8EAA8E;IAC9E,WAAW,EAAE,SAAS,GAAG,QAAQ,CAAA;IACjC,oDAAoD;IACpD,uBAAuB,EAAE,uBAAuB,CAAA;CACjD,CAAA;AAED,0EAA0E;AAC1E,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,gCAAgC,QAAS,CAAA;AAEtD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,wBAAwB,OAAO,CAAA;AAE5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,uBAAuB,MAAM,CAAA;AAE1C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,8BAA8B,MAAM,CAAA;AAEjD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,uBAAuB,GAAG,SAAS,GAC7C,uBAAuB,CASzB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,0BAA0B,GAAG,SAAS,EAC/C,WAAW,EAAE,sBAAsB,GAAG,SAAS,GAC9C,mBAAmB,CAwBrB"}
|
|
@@ -54,11 +54,10 @@ export const DEFAULT_MANUAL_FALLBACK_AFTER_MS = 30_000;
|
|
|
54
54
|
/**
|
|
55
55
|
* Camera width worth requesting for auto-capture, as a RECOMMENDATION.
|
|
56
56
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* guide on 2560 is 1018x1440.
|
|
57
|
+
* An A4 page filling the portrait guide on the default 1920-wide 16:9 stream
|
|
58
|
+
* spans about 764x1080 pixels, so it lands near 90 DPI — 6pt print about two
|
|
59
|
+
* pixels tall. That is a sampling limit, not blur, and no focus threshold
|
|
60
|
+
* recovers it. The same page on 2560 is about 1018x1440.
|
|
62
61
|
*
|
|
63
62
|
* NOT APPLIED AUTOMATICALLY, and that is the finding rather than an oversight.
|
|
64
63
|
* It was, briefly, and it made captures materially harder to land: the loop
|
|
@@ -28,6 +28,11 @@ export type DocumentCaptureControllerConfig = {
|
|
|
28
28
|
now?: () => Date;
|
|
29
29
|
acquireCamera?: typeof acquireCamera;
|
|
30
30
|
createObjectUrl?: (blob: Blob) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Grabs and encodes the frame. `aspectRatio` is the opted-in document's
|
|
33
|
+
* guide aspect, passed so a custom grab can see the guide box; the default
|
|
34
|
+
* saves the whole frame and does not use it.
|
|
35
|
+
*/
|
|
31
36
|
captureFrame?: (source: CaptureFrameSource, aspectRatio?: number) => Promise<Blob | null>;
|
|
32
37
|
/** Mirrors idCapture's `io.createPipeline`: the whole ML half, injectable. */
|
|
33
38
|
createAutoCaptureEngine?: typeof createAutoCaptureEngine;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/documentCapture/controller.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EAE1B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAIhE,OAAO,EACL,uBAAuB,EAEvB,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/documentCapture/controller.ts"],"names":[],"mappings":"AA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
|
import { error, warn } from '../utils/logger';
|
|
21
21
|
import { createAutoCaptureEngine, } from './autoCaptureEngine';
|
|
22
|
-
import { computeGuideRect } from './autoCaptureGeometry';
|
|
23
22
|
import { advanceAutoCaptureShutter, createAutoCaptureShutterState, openManualBurst, retryAutoCaptureShutter, } from './autoCaptureShutter';
|
|
24
23
|
import { resolveAutoCapture } from './autoCaptureOptions';
|
|
25
24
|
import { accumulateFrame, buildAttemptMetadata, createAttemptAccumulator, retryAttempt, toFileMetadata, } from './autoCaptureMetadata';
|
|
@@ -34,30 +33,45 @@ import { buildEntries, createInitialDocumentCaptureState, toCapturedDocument, }
|
|
|
34
33
|
*/
|
|
35
34
|
const UNRANKED_FOCUS = -1;
|
|
36
35
|
/**
|
|
37
|
-
* Default frame grab:
|
|
36
|
+
* Default frame grab: the WHOLE camera frame, encoded as a JPEG.
|
|
38
37
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
38
|
+
* Saved uncropped because the checks run on the whole frame, and a sheet is
|
|
39
|
+
* only guaranteed complete within the rectangle they looked at. #385 cropped to
|
|
40
|
+
* the guide rect — the box the applicant is asked to fill — on the reasoning
|
|
41
|
+
* that "what you framed is what you submit" only holds while the two agree. It
|
|
42
|
+
* did the opposite on a portrait phone: the guide spans the camera's full width
|
|
43
|
+
* but leaves ~196px of frame above and below it, so a sheet spilling past the
|
|
44
|
+
* guide's top was seen whole by the detector, passed every gate, and was then
|
|
45
|
+
* cut by the crop. Product testing caught one.
|
|
44
46
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
+
* Uncropped, only the camera itself can cut the page, and that is the one edge
|
|
48
|
+
* auto-capture already refuses to fire on (`touchesFrameEdge`). A manual tap
|
|
49
|
+
* is not checked — it is the applicant's call, and saves whatever was in
|
|
50
|
+
* frame. The guide rect still decides framing — `fill` is measured against it,
|
|
51
|
+
* and it is what the applicant is shown — it just no longer decides which
|
|
52
|
+
* pixels are thrown away.
|
|
53
|
+
*
|
|
54
|
+
* Takes no `aspectRatio`, though the controller passes one: that argument
|
|
55
|
+
* exists for a custom `io.captureFrame`, and the whole frame is the answer
|
|
56
|
+
* here whatever the guide's shape.
|
|
57
|
+
*
|
|
58
|
+
* The cost is background around the page: a band of desk above and below on a
|
|
59
|
+
* phone, and on a 16:9 webcam the desk either side of a page column. That is
|
|
60
|
+
* the image every document got before `autoCapture` existed, so it is not new
|
|
61
|
+
* to any backend.
|
|
47
62
|
*
|
|
48
63
|
* The `drawImage` is SYNCHRONOUS and must stay that way — `captureSource` can
|
|
49
64
|
* hand over the auto-capture engine's live frame canvas, which the next frame
|
|
50
65
|
* overwrites. Everything before the `toBlob` runs in the caller's own tick.
|
|
51
66
|
*/
|
|
52
|
-
function defaultCaptureFrame(source
|
|
53
|
-
const rect = computeGuideRect(source.width, source.height, aspectRatio);
|
|
67
|
+
function defaultCaptureFrame(source) {
|
|
54
68
|
const canvas = document.createElement('canvas');
|
|
55
|
-
canvas.width =
|
|
56
|
-
canvas.height =
|
|
69
|
+
canvas.width = source.width;
|
|
70
|
+
canvas.height = source.height;
|
|
57
71
|
const ctx = canvas.getContext('2d');
|
|
58
72
|
if (!ctx)
|
|
59
73
|
return Promise.resolve(null);
|
|
60
|
-
ctx.drawImage(source.image,
|
|
74
|
+
ctx.drawImage(source.image, 0, 0, source.width, source.height);
|
|
61
75
|
return new Promise((resolve) => canvas.toBlob(resolve, 'image/jpeg', 0.95));
|
|
62
76
|
}
|
|
63
77
|
// `acquireCamera` rejects with a `CaptureAttachError` carrying the precise
|
|
@@ -287,7 +301,8 @@ export function createDocumentCaptureController(config) {
|
|
|
287
301
|
const thisEngine = makeAutoCaptureEngine({
|
|
288
302
|
...config.autoCaptureEngine,
|
|
289
303
|
autoCapture: wanted,
|
|
290
|
-
//
|
|
304
|
+
// The guide rect the gate measures `fill` against. The saved image is
|
|
305
|
+
// the whole frame regardless — see defaultCaptureFrame.
|
|
291
306
|
aspectRatio: entry.item.aspectRatio,
|
|
292
307
|
onModelsChanged: (models) => dispatch({ type: 'autoCaptureModelsChanged', models }),
|
|
293
308
|
onDiagnostics: (diagnostics) => {
|
|
@@ -573,12 +588,13 @@ export function createDocumentCaptureController(config) {
|
|
|
573
588
|
const { source, acceptedFrame } = chosen;
|
|
574
589
|
dispatch({ type: 'captureRequested' });
|
|
575
590
|
try {
|
|
576
|
-
// The
|
|
577
|
-
//
|
|
578
|
-
// integrator who passes `aspectRatio` and
|
|
579
|
-
//
|
|
580
|
-
//
|
|
581
|
-
//
|
|
591
|
+
// The default saves the whole frame for every document — see
|
|
592
|
+
// defaultCaptureFrame — which keeps spec §3.1 by construction: a 2.x
|
|
593
|
+
// integrator who passes `aspectRatio` and no `autoCapture` gets the same
|
|
594
|
+
// bytes they have received since 2.4, because nobody gets a crop.
|
|
595
|
+
//
|
|
596
|
+
// The guide aspect is still passed, opted-in documents only, because
|
|
597
|
+
// `io.captureFrame` is public and custom grabs were written against it.
|
|
582
598
|
const item = store.getState().documents[index]?.item;
|
|
583
599
|
const content = await captureFrame(source, item?.autoCapture ? item.aspectRatio : undefined);
|
|
584
600
|
// Detached mid-capture: dispatching now would mutate a dead controller's
|
|
@@ -4,7 +4,7 @@ export { accumulateFrame, buildAttemptMetadata, createAttemptAccumulator, retryA
|
|
|
4
4
|
export { advanceAutoCaptureShutter, burstWindowFrames, createAutoCaptureShutterState, escapeBudgetFrames, openManualBurst, retryAutoCaptureShutter, type AutoCaptureShutterDecision, type AutoCaptureShutterFrame, type AutoCaptureShutterState, } from './autoCaptureShutter';
|
|
5
5
|
export { advancePoaGuidance, createPoaGuidanceState, poaGuidanceCode, poaGuidanceDiagnostics, type PoaGuidanceCode, type PoaGuidanceDiagnostics, type PoaGuidanceState, } from './autoCaptureGuidance';
|
|
6
6
|
export { resolveAutoCapture, resolveDocumentDetectorRuntime, AUTO_CAPTURE_VIDEO_WIDTH, DEFAULT_MANUAL_FALLBACK_AFTER_MS, DEFAULT_STABILITY_FRAMES, DEFAULT_STABILITY_IOU, type AutoCaptureEnvironment, type DocumentAutoCaptureOptions, type DocumentAutoCaptureThresholds, type ResolvedAutoCapture, } from './autoCaptureOptions';
|
|
7
|
-
export { computePoaFillWindow, computePoaFraming, failingPoaGates, isAutoCaptureSatisfied, winningPoaGate, peakScoresByLabel, selectPoaTarget, POA_FILL_MAX, POA_FILL_MIN, POA_FOCUS_THRESHOLDS, POA_GATE_ORDER, POA_MIN_SCORE, POA_TARGET_LABELS, type AutoCaptureDiagnostics, type AutoCaptureFocusDiagnostics, type AutoCaptureStabilityDiagnostics, type PoaFillWindow, type PoaFillWindowOptions, type PoaFraming, type PoaGate, type PoaGateInputs, type PoaTarget, } from './autoCaptureGeometry';
|
|
7
|
+
export { computePoaFillWindow, computePoaFraming, touchesFrameEdge, failingPoaGates, isAutoCaptureSatisfied, winningPoaGate, peakScoresByLabel, selectPoaTarget, POA_FILL_MAX, POA_FILL_MIN, POA_FOCUS_THRESHOLDS, POA_GATE_ORDER, POA_MIN_SCORE, POA_TARGET_LABELS, type AutoCaptureDiagnostics, type AutoCaptureFocusDiagnostics, type AutoCaptureStabilityDiagnostics, type PoaFillWindow, type PoaFillWindowOptions, type PoaFraming, type PoaGate, type PoaGateInputs, type PoaTarget, } from './autoCaptureGeometry';
|
|
8
8
|
export { buildEntries, createInitialDocumentCaptureState, toCapturedDocument, type AutoCaptureShutterStatus, type CapturedDocument, type DocumentCaptureCompleteHandler, type DocumentCaptureMode, type DocumentCaptureControllerState, type DocumentCaptureEntry, type DocumentCaptureError, type DocumentCaptureInput, type DocumentCaptureItem, type DocumentUploadState, } from './state';
|
|
9
9
|
export { reduceDocumentCapture, type DocumentCaptureEvent, } from './reducer';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/documentCapture/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,+BAA+B,EAC/B,K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AoB,EACzB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,SAAS,GACf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,YAAY,EACZ,iCAAiC,EACjC,kBAAkB,EAClB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,8BAA8B,EACnC,KAAK,mBAAmB,EACxB,KAAK,8BAA8B,EACnC,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,qBAAqB,EACrB,KAAK,oBAAoB,GAC1B,MAAM,WAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/documentCapture/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,+BAA+B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,GACrC,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACxB,YAAY,EACZ,cAAc,EACd,0BAA0B,EAC1B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,GACpC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,6BAA6B,EAC7B,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,GAC7B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,GACtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,kBAAkB,EAClB,8BAA8B,EAC9B,wBAAwB,EACxB,gCAAgC,EAChC,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,GACzB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EACpC,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,SAAS,GACf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,YAAY,EACZ,iCAAiC,EACjC,kBAAkB,EAClB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,8BAA8B,EACnC,KAAK,mBAAmB,EACxB,KAAK,8BAA8B,EACnC,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,qBAAqB,EACrB,KAAK,oBAAoB,GAC1B,MAAM,WAAW,CAAA"}
|
|
@@ -9,6 +9,6 @@ export { accumulateFrame, buildAttemptMetadata, createAttemptAccumulator, retryA
|
|
|
9
9
|
export { advanceAutoCaptureShutter, burstWindowFrames, createAutoCaptureShutterState, escapeBudgetFrames, openManualBurst, retryAutoCaptureShutter, } from './autoCaptureShutter';
|
|
10
10
|
export { advancePoaGuidance, createPoaGuidanceState, poaGuidanceCode, poaGuidanceDiagnostics, } from './autoCaptureGuidance';
|
|
11
11
|
export { resolveAutoCapture, resolveDocumentDetectorRuntime, AUTO_CAPTURE_VIDEO_WIDTH, DEFAULT_MANUAL_FALLBACK_AFTER_MS, DEFAULT_STABILITY_FRAMES, DEFAULT_STABILITY_IOU, } from './autoCaptureOptions';
|
|
12
|
-
export { computePoaFillWindow, computePoaFraming, failingPoaGates, isAutoCaptureSatisfied, winningPoaGate, peakScoresByLabel, selectPoaTarget, POA_FILL_MAX, POA_FILL_MIN, POA_FOCUS_THRESHOLDS, POA_GATE_ORDER, POA_MIN_SCORE, POA_TARGET_LABELS, } from './autoCaptureGeometry';
|
|
12
|
+
export { computePoaFillWindow, computePoaFraming, touchesFrameEdge, failingPoaGates, isAutoCaptureSatisfied, winningPoaGate, peakScoresByLabel, selectPoaTarget, POA_FILL_MAX, POA_FILL_MIN, POA_FOCUS_THRESHOLDS, POA_GATE_ORDER, POA_MIN_SCORE, POA_TARGET_LABELS, } from './autoCaptureGeometry';
|
|
13
13
|
export { buildEntries, createInitialDocumentCaptureState, toCapturedDocument, } from './state';
|
|
14
14
|
export { reduceDocumentCapture, } from './reducer';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type BarcodeParsingMode, type IdCaptureFlowState } from './state';
|
|
2
|
-
import type
|
|
2
|
+
import { type CapturedDocuments } from './types';
|
|
3
3
|
import type { IdCaptureRequirementOption } from './requirements';
|
|
4
4
|
import { type IdCaptureThresholds, createDetectionPipeline } from './pipeline';
|
|
5
5
|
import { type GuidanceEvent, type InstructionCode, type RequestedAction } from './guidance';
|
|
@@ -88,6 +88,9 @@ export type IdCaptureControllerConfig = {
|
|
|
88
88
|
enableHologramOcclusionGuidance?: boolean;
|
|
89
89
|
enableOverrideWrongDocumentTypeDialog?: boolean;
|
|
90
90
|
allowOverrideWrongDocumentTypeAfterMs?: number;
|
|
91
|
+
/** Capture and decode barcode crops. False also disables barcode model loading
|
|
92
|
+
* and recapture, and ignores precaptured barcode images. Defaults to true. */
|
|
93
|
+
enableBarcodeCapture?: boolean;
|
|
91
94
|
enableBarcodeRecapture?: boolean;
|
|
92
95
|
barcodeRecaptureThreshold?: number;
|
|
93
96
|
barcodeRecaptureTimeoutMs?: number;
|