idmission-web-sdk 2.3.115 → 2.3.116
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/dist/components/common/debug.d.ts +1 -1
- package/dist/components/common/debug.d.ts.map +1 -1
- package/dist/components/selfie_capture/SelfieGuidanceModelsProvider.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureCapture.d.ts.map +1 -1
- package/dist/lib/models/DocumentDetection.d.ts +1 -2
- package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
- package/dist/lib/models/FaceDetection.d.ts +4 -5
- package/dist/lib/models/FaceDetection.d.ts.map +1 -1
- package/dist/lib/models/defaults/DocumentDetector.d.ts +2 -2
- package/dist/sdk2.cjs.development.js +201 -106
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +202 -107
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +201 -106
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +3 -3
|
@@ -52,7 +52,7 @@ export type SelfieCaptureFaceDebugBoxProps = {
|
|
|
52
52
|
};
|
|
53
53
|
export declare function SelfieCaptureFaceDebugBox({ face, flipX, color, scaling, }: SelfieCaptureFaceDebugBoxProps): ReactElement;
|
|
54
54
|
type SelfieCaptureFaceKeypointProps = {
|
|
55
|
-
point: FaceKeypoint
|
|
55
|
+
point: FaceKeypoint;
|
|
56
56
|
scaling: DebugScalingDetails;
|
|
57
57
|
flipX?: boolean;
|
|
58
58
|
color?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../../src/components/common/debug.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,YAAY,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CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,wBAAgB,yBAAyB,CAAC,EACxC,KAAK,EACL,KAAK,EACL,KAAa,EACb,OAAO,EAAE,EACP,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,OAAO,EACP,OAAO,GACR,GACF,EAAE,8BAA8B,GAAG,YAAY,CAoB/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelfieGuidanceModelsProvider.d.ts","sourceRoot":"","sources":["../../../src/components/selfie_capture/SelfieGuidanceModelsProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAEL,gBAAgB,EAChB,YAAY,EACZ,SAAS,EAKV,MAAM,OAAO,CAAA;AAGd,OAAO,EAEL,uBAAuB,
|
|
1
|
+
{"version":3,"file":"SelfieGuidanceModelsProvider.d.ts","sourceRoot":"","sources":["../../../src/components/selfie_capture/SelfieGuidanceModelsProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAEL,gBAAgB,EAChB,YAAY,EACZ,SAAS,EAKV,MAAM,OAAO,CAAA;AAGd,OAAO,EAEL,uBAAuB,EAKxB,MAAM,gCAAgC,CAAA;AAIvC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAMzD,MAAM,MAAM,+BAA+B,GAAG,CAC5C,UAAU,EAAE,uBAAuB,KAChC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAEzB,KAAK,yBAAyB,GAAG;IAC/B,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,gBAAgB,EAAE,CAAC,OAAO,EAAE,+BAA+B,KAAK,IAAI,CAAA;IACpE,SAAS,EAAE,gBAAgB,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IACrD,KAAK,EAAE,OAAO,CAAA;IACd,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,cAAc,EAAE,cAAc,CAAA;IAC9B,qBAAqB,EAAE,MAAM,CAAA;IAC7B,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,2BAA2B,0CAWpC,CAAA;AAEJ,MAAM,MAAM,iCAAiC,GAAG;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,SAAS,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IACrC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,4BAA4B,CAAC,EAAE,OAAO,CAAA;IACtC,6BAA6B,CAAC,EAAE,MAAM,CAAA;IACtC,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,2BAA2B,CAAC,EAAE,MAAM,CAAA;CACrC,CAAA;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,SAAgB,EAChB,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,kBAA2D,EAC3D,4BAAmC,EACnC,6BAA6B,EAC7B,wBAAwB,EACxB,2BAA2B,GAC5B,EAAE,iCAAiC,GAAG,YAAY,CAqIlD;AAED,wBAAgB,8BAA8B,IAAI,yBAAyB,CAQ1E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoSignatureCapture.d.ts","sourceRoot":"","sources":["../../../src/components/video_signature_capture/VideoSignatureCapture.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,aAAa,EAMd,MAAM,OAAO,CAAA;AAad,OAAO,EAAE,wBAAwB,EAAmB,MAAM,mBAAmB,CAAA;AAC7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAA;AACvF,OAA6B,EAC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GAAG,MAAM,CAAA;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,+BAA+B,CAAA;IAC5C,MAAM,CAAC,EAAE,2BAA2B,CAAA;IACpC,QAAQ,CAAC,EAAE,6BAA6B,CAAA;IACxC,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;
|
|
1
|
+
{"version":3,"file":"VideoSignatureCapture.d.ts","sourceRoot":"","sources":["../../../src/components/video_signature_capture/VideoSignatureCapture.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,aAAa,EAMd,MAAM,OAAO,CAAA;AAad,OAAO,EAAE,wBAAwB,EAAmB,MAAM,mBAAmB,CAAA;AAC7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAA;AACvF,OAA6B,EAC3B,8BAA8B,EAC9B,4BAA4B,EAC7B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,wBAAwB,EAEzB,MAAM,yBAAyB,CAAA;AAQhC,eAAO,MAAM,gCAAgC,KAAK,CAAA;AAClD,eAAO,MAAM,yCAAyC,OAAO,CAAA;AAC7D,eAAO,MAAM,mCAAmC,SAAS,CAAA;AAEzD,MAAM,MAAM,wBAAwB,GAAG;IACrC,iBAAiB,EAAE,MAAM,IAAI,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,8BAA8B,CAAA;CACxC,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,8BAA8B,CAAC,EAAE,MAAM,CAAA;IACvC,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,mBAAmB,CAAC,EAAE,wBAAwB,CAAA;IAC9C,MAAM,CAAC,EAAE,4BAA4B,CAAA;CACtC,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;IACnD,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,iCAAiC,CAAC,EAAE,OAAO,CAAA;IAC3C,eAAe,CAAC,EAAE,aAAa,CAAC,4BAA4B,CAAC,CAAA;IAC7D,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,8BAA8B,CAAC,EAAE,MAAM,CAAA;IACvC,wBAAwB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,+BAA+B,CAAA;IAC5C,MAAM,CAAC,EAAE,2BAA2B,CAAA;IACpC,QAAQ,CAAC,EAAE,6BAA6B,CAAA;IACxC,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAkMD,eAAO,MAAM,qBAAqB,6GAGD,CAAA"}
|
|
@@ -13,7 +13,7 @@ export declare const documentTypeDisplayNames: {
|
|
|
13
13
|
singlePage: string;
|
|
14
14
|
none: string;
|
|
15
15
|
};
|
|
16
|
-
export type Label = 'Document' | 'Document back' | 'MRZ' | 'PDF417' | 'Primary face' | 'Secondary face' | '
|
|
16
|
+
export type Label = 'Document' | 'Document back' | 'MRZ' | 'PDF417' | 'Primary face' | 'Secondary face' | 'Glare' | 'Punch Hole' | 'Passport page' | 'Single page';
|
|
17
17
|
export type DetectedObjectBox = {
|
|
18
18
|
xMin: number;
|
|
19
19
|
xMax: number;
|
|
@@ -36,7 +36,6 @@ export type DocumentThresholds = {
|
|
|
36
36
|
export type DocumentDetectionThresholds = DocumentThresholds & {
|
|
37
37
|
stability?: DocumentThresholds;
|
|
38
38
|
};
|
|
39
|
-
export declare function getDocumentDetector(): ObjectDetector | null;
|
|
40
39
|
export declare function loadDocumentDetector(modelAssetPath?: string, scoreThreshold?: number): Promise<ObjectDetector>;
|
|
41
40
|
export declare function closeDocumentDetector(): void;
|
|
42
41
|
export declare function useLoadDocumentDetector({ shouldLoadModels, modelPath, modelLoadTimeoutMs, scoreThreshold, onModelError, videoRef, }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentDetection.d.ts","sourceRoot":"","sources":["../../../src/lib/models/DocumentDetection.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,oBAAoB,EACrB,MAAM,yBAAyB,CAAA;AAQhC,OAAO,EAIL,cAAc,EAEf,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,gBAAgB,EAAgC,MAAM,OAAO,CAAA;AAItE,cAAc,6BAA6B,CAAA;AAC3C,eAAO,MAAM,sCAAsC,MAAM,CAAA;AACzD,eAAO,MAAM,0CAA0C,QAAQ,CAAA;AAC/D,eAAO,MAAM,kCAAkC,EAAE,2BAWhD,CAAA;AAED,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,aAAa,GACb,YAAY,GACZ,UAAU,GACV,YAAY,CAAA;AAEhB,eAAO,MAAM,wBAAwB;;;;;;CAMpC,CAAA;AAED,MAAM,MAAM,KAAK,GACb,UAAU,GACV,eAAe,GACf,KAAK,GACL,QAAQ,GACR,cAAc,GACd,gBAAgB,GAChB,
|
|
1
|
+
{"version":3,"file":"DocumentDetection.d.ts","sourceRoot":"","sources":["../../../src/lib/models/DocumentDetection.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,oBAAoB,EACrB,MAAM,yBAAyB,CAAA;AAQhC,OAAO,EAIL,cAAc,EAEf,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,gBAAgB,EAAgC,MAAM,OAAO,CAAA;AAItE,cAAc,6BAA6B,CAAA;AA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C5D,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,wBAAsB,8BAA8B,CAClD,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAiB1C;AAED,eAAO,IAAI,eAAe,QAAI,CAAA;AAC9B,eAAO,IAAI,iBAAiB,QAAI,CAAA;AAEhC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,QAG9C;AA8BD,MAAM,MAAM,2BAA2B,GAAG;IACxC,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,kCAAkC,EAAE,2BAKhD,CAAA;AAED,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,wBAAwB,EACpC,UAAU,EAAE,2BAA2B,EACvC,UAAU,GAAE,2BAAgE,GAC3E,2BAA2B,CAgJ7B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FaceDetector, FaceDetectorResult
|
|
1
|
+
import { FaceDetector, FaceDetectorResult } from '@mediapipe/tasks-vision';
|
|
2
2
|
import { MutableRefObject } from 'react';
|
|
3
3
|
import { Frame } from '../utils/getFrameDimensions';
|
|
4
4
|
import { ModelLoadState } from './helpers';
|
|
@@ -10,7 +10,7 @@ export type FaceKeypoint = {
|
|
|
10
10
|
name: string;
|
|
11
11
|
};
|
|
12
12
|
export type Face = {
|
|
13
|
-
keypoints:
|
|
13
|
+
keypoints: FaceKeypoint[];
|
|
14
14
|
box: {
|
|
15
15
|
xMin: number;
|
|
16
16
|
xMax: number;
|
|
@@ -52,13 +52,11 @@ export declare function setLastFaceDetectionAt(time: number): void;
|
|
|
52
52
|
export declare function makeFaceDetectorPrediction(imageData: Frame): (FaceDetectorResult & {
|
|
53
53
|
faces: Face[];
|
|
54
54
|
}) | null;
|
|
55
|
-
export declare function makeFacePredictionWithDocumentDetector(frame: HTMLCanvasElement): Promise<(ObjectDetectorResult & {
|
|
56
|
-
faces: Face[];
|
|
57
|
-
}) | null>;
|
|
58
55
|
export declare function processFaceDetectorPrediction({ faces, videoWidth, videoHeight, requireVerticalFaceCentering, stabilityThreshold, noseDistanceThreshold, xBoundary, // this represents the edge that the sides of the face box should not cross -- 1% of video width
|
|
59
56
|
yBoundary, // this represents the edge that the top or bottom of the face box should not cross -- 1% of video height
|
|
60
57
|
xCentroidBoundary, // this represents the edge that the centroid of the face should not cross -- 12.5% of video width
|
|
61
58
|
yCentroidBoundary, // this represents the edge that the centroid of the face should not cross -- 12.5% of video height
|
|
59
|
+
foreheadRatio, // we found that the bounding box ends at the brow and misses the forehead. this ratio represents how much we should extend the box to include the forehead.
|
|
62
60
|
noseTrackingThreshold, // this represents the maximum distance that the nose can be from the center of the face box -- 20% of the face box width or height
|
|
63
61
|
minCaptureBrightnessThreshold, minCaptureRangeThreshold, minCaptureVarianceThreshold, brightness, range, variance, }: {
|
|
64
62
|
faces: Face[];
|
|
@@ -71,6 +69,7 @@ minCaptureBrightnessThreshold, minCaptureRangeThreshold, minCaptureVarianceThres
|
|
|
71
69
|
yBoundary?: number;
|
|
72
70
|
xCentroidBoundary?: number;
|
|
73
71
|
yCentroidBoundary?: number;
|
|
72
|
+
foreheadRatio?: number;
|
|
74
73
|
noseTrackingThreshold?: number;
|
|
75
74
|
minCaptureBrightnessThreshold?: number;
|
|
76
75
|
minCaptureRangeThreshold?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FaceDetection.d.ts","sourceRoot":"","sources":["../../../src/lib/models/FaceDetection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,
|
|
1
|
+
{"version":3,"file":"FaceDetection.d.ts","sourceRoot":"","sources":["../../../src/lib/models/FaceDetection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,Y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,CAAA;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,6BAA6B,CAAC,EAAE,MAAM,CAAA;IACtC,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,2BAA2B,CAAC,EAAE,MAAM,CAAA;IACpC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,uBAAuB,CAyH1B"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const defaultDocumentDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/DocumentDetector/DocumentDetector-
|
|
2
|
-
export declare const defaultDocumentDetectorModelHash = "
|
|
1
|
+
export declare const defaultDocumentDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/DocumentDetector/DocumentDetector-20250815_115859.tflite";
|
|
2
|
+
export declare const defaultDocumentDetectorModelHash = "64LSaO2ctQsTkGJoZ6Et4v2KH28Fz1ettgkxD+qFg6frxY7ufL9l/lkjw2ljX2cR";
|
|
3
3
|
//# sourceMappingURL=DocumentDetector.d.ts.map
|
|
@@ -236,7 +236,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
236
236
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
237
237
|
};
|
|
238
238
|
|
|
239
|
-
var webSdkVersion = '2.3.
|
|
239
|
+
var webSdkVersion = '2.3.116';
|
|
240
240
|
|
|
241
241
|
function getPlatform() {
|
|
242
242
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -2379,8 +2379,8 @@ function giveUpAfter(maxTime) {
|
|
|
2379
2379
|
|
|
2380
2380
|
var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
|
|
2381
2381
|
|
|
2382
|
-
var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-
|
|
2383
|
-
var defaultDocumentDetectorModelHash = '
|
|
2382
|
+
var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20250815_115859.tflite");
|
|
2383
|
+
var defaultDocumentDetectorModelHash = '64LSaO2ctQsTkGJoZ6Et4v2KH28Fz1ettgkxD+qFg6frxY7ufL9l/lkjw2ljX2cR';
|
|
2384
2384
|
|
|
2385
2385
|
var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
|
|
2386
2386
|
var defaultFocusModelHash = 'HTJNLB7QybtPXIIyUI9oNqW40vE5bgSV5V24R1wXLQHknNEVOSyDQDo/QzRgJ8jb';
|
|
@@ -2697,8 +2697,8 @@ var documentTypeDisplayNames = {
|
|
|
2697
2697
|
singlePage: 'Single page',
|
|
2698
2698
|
none: 'None'
|
|
2699
2699
|
};
|
|
2700
|
-
var detector = null;
|
|
2701
|
-
var detectorSettings = null;
|
|
2700
|
+
var detector$1 = null;
|
|
2701
|
+
var detectorSettings$1 = null;
|
|
2702
2702
|
function loadDocumentDetector() {
|
|
2703
2703
|
return __awaiter(this, arguments, void 0, function (modelAssetPath, scoreThreshold) {
|
|
2704
2704
|
var _a, _b;
|
|
@@ -2711,7 +2711,7 @@ function loadDocumentDetector() {
|
|
|
2711
2711
|
return __generator(this, function (_c) {
|
|
2712
2712
|
switch (_c.label) {
|
|
2713
2713
|
case 0:
|
|
2714
|
-
if (detector && (detectorSettings === null || detectorSettings === void 0 ? void 0 : detectorSettings.modelAssetPath) === modelAssetPath && (detectorSettings === null || detectorSettings === void 0 ? void 0 : detectorSettings.scoreThreshold) === scoreThreshold) return [2 /*return*/, detector];
|
|
2714
|
+
if (detector$1 && (detectorSettings$1 === null || detectorSettings$1 === void 0 ? void 0 : detectorSettings$1.modelAssetPath) === modelAssetPath && (detectorSettings$1 === null || detectorSettings$1 === void 0 ? void 0 : detectorSettings$1.scoreThreshold) === scoreThreshold) return [2 /*return*/, detector$1];
|
|
2715
2715
|
closeDocumentDetector();
|
|
2716
2716
|
return [4 /*yield*/, preloadDocumentDetectorDependencies()];
|
|
2717
2717
|
case 1:
|
|
@@ -2732,20 +2732,20 @@ function loadDocumentDetector() {
|
|
|
2732
2732
|
runningMode: 'VIDEO'
|
|
2733
2733
|
}])];
|
|
2734
2734
|
case 3:
|
|
2735
|
-
detector = _c.sent();
|
|
2736
|
-
detectorSettings = {
|
|
2735
|
+
detector$1 = _c.sent();
|
|
2736
|
+
detectorSettings$1 = {
|
|
2737
2737
|
modelAssetPath: modelAssetPath,
|
|
2738
2738
|
scoreThreshold: scoreThreshold
|
|
2739
2739
|
};
|
|
2740
|
-
return [2 /*return*/, detector];
|
|
2740
|
+
return [2 /*return*/, detector$1];
|
|
2741
2741
|
}
|
|
2742
2742
|
});
|
|
2743
2743
|
});
|
|
2744
2744
|
}
|
|
2745
2745
|
function closeDocumentDetector() {
|
|
2746
|
-
detector === null || detector === void 0 ? void 0 : detector.close();
|
|
2747
|
-
detector = null;
|
|
2748
|
-
detectorSettings = null;
|
|
2746
|
+
detector$1 === null || detector$1 === void 0 ? void 0 : detector$1.close();
|
|
2747
|
+
detector$1 = null;
|
|
2748
|
+
detectorSettings$1 = null;
|
|
2749
2749
|
}
|
|
2750
2750
|
function useLoadDocumentDetector(_a) {
|
|
2751
2751
|
var _b = _a.shouldLoadModels,
|
|
@@ -2846,12 +2846,12 @@ function makeDocumentDetectorPrediction(frame) {
|
|
|
2846
2846
|
return __awaiter(this, void 0, void 0, function () {
|
|
2847
2847
|
var startedAt, prediction, time, frameWidth, frameHeight;
|
|
2848
2848
|
return __generator(this, function (_a) {
|
|
2849
|
-
if (!detector) return [2 /*return*/, null];
|
|
2849
|
+
if (!detector$1) return [2 /*return*/, null];
|
|
2850
2850
|
startedAt = performance.now();
|
|
2851
2851
|
// Detectors can throw errors, for example when using custom URLs that
|
|
2852
2852
|
// contain a model that doesn't provide the expected output.
|
|
2853
2853
|
try {
|
|
2854
|
-
prediction = detector.detectForVideo(frame, performance.now());
|
|
2854
|
+
prediction = detector$1.detectForVideo(frame, performance.now());
|
|
2855
2855
|
time = performance.now() - startedAt;
|
|
2856
2856
|
frameWidth = frame.width;
|
|
2857
2857
|
frameHeight = frame.height;
|
|
@@ -6831,7 +6831,6 @@ function SelfieCaptureFaceKeypoint(_a) {
|
|
|
6831
6831
|
scaledHeight = _c.scaledHeight,
|
|
6832
6832
|
xOffset = _c.xOffset,
|
|
6833
6833
|
yOffset = _c.yOffset;
|
|
6834
|
-
if (!point) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null);
|
|
6835
6834
|
var left, top;
|
|
6836
6835
|
if (horizontal) {
|
|
6837
6836
|
left = point.x / videoWidth * scaledWidth - xOffset;
|
|
@@ -11906,6 +11905,136 @@ var FaceCaptureGuideOverlay = function FaceCaptureGuideOverlay(_a) {
|
|
|
11906
11905
|
var templateObject_1$n, templateObject_2$l;
|
|
11907
11906
|
|
|
11908
11907
|
var defaultSelfieCaptureModelLoadTimeoutMs = 45000;
|
|
11908
|
+
var detector = null;
|
|
11909
|
+
var detectorSettings = null;
|
|
11910
|
+
function loadFaceDetector() {
|
|
11911
|
+
return __awaiter(this, arguments, void 0, function (modelAssetPath) {
|
|
11912
|
+
var _a, _b;
|
|
11913
|
+
if (modelAssetPath === void 0) {
|
|
11914
|
+
modelAssetPath = defaultFaceDetectorModelPath;
|
|
11915
|
+
}
|
|
11916
|
+
return __generator(this, function (_c) {
|
|
11917
|
+
switch (_c.label) {
|
|
11918
|
+
case 0:
|
|
11919
|
+
if (detector && (detectorSettings === null || detectorSettings === void 0 ? void 0 : detectorSettings.modelAssetPath) === modelAssetPath) return [2 /*return*/, detector];
|
|
11920
|
+
closeFaceDetector();
|
|
11921
|
+
return [4 /*yield*/, preloadFaceDetectorDependencies()];
|
|
11922
|
+
case 1:
|
|
11923
|
+
_c.sent();
|
|
11924
|
+
if (modelCapabilities.delegate === 'NONE') {
|
|
11925
|
+
throw new Error('No available delegate for face detector.');
|
|
11926
|
+
}
|
|
11927
|
+
_b = (_a = tasksVision.FaceDetector).createFromOptions;
|
|
11928
|
+
return [4 /*yield*/, tasksVision.FilesetResolver.forVisionTasks(visionTasksBasePath)];
|
|
11929
|
+
case 2:
|
|
11930
|
+
return [4 /*yield*/, _b.apply(_a, [_c.sent(), {
|
|
11931
|
+
// canvas: document.createElement('canvas'),
|
|
11932
|
+
baseOptions: {
|
|
11933
|
+
modelAssetPath: modelAssetPath,
|
|
11934
|
+
delegate: modelCapabilities.delegate
|
|
11935
|
+
},
|
|
11936
|
+
runningMode: 'VIDEO'
|
|
11937
|
+
}])];
|
|
11938
|
+
case 3:
|
|
11939
|
+
detector = _c.sent();
|
|
11940
|
+
detectorSettings = {
|
|
11941
|
+
modelAssetPath: modelAssetPath
|
|
11942
|
+
};
|
|
11943
|
+
return [2 /*return*/, detector];
|
|
11944
|
+
}
|
|
11945
|
+
});
|
|
11946
|
+
});
|
|
11947
|
+
}
|
|
11948
|
+
function closeFaceDetector() {
|
|
11949
|
+
detector === null || detector === void 0 ? void 0 : detector.close();
|
|
11950
|
+
detector = null;
|
|
11951
|
+
detectorSettings = null;
|
|
11952
|
+
}
|
|
11953
|
+
function useLoadFaceDetector(_a) {
|
|
11954
|
+
var onModelError = _a.onModelError,
|
|
11955
|
+
_b = _a.modelLoadTimeoutMs,
|
|
11956
|
+
modelLoadTimeoutMs = _b === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _b,
|
|
11957
|
+
videoRef = _a.videoRef;
|
|
11958
|
+
var _c = React.useState('not-started'),
|
|
11959
|
+
modelLoadState = _c[0],
|
|
11960
|
+
setModelLoadState = _c[1];
|
|
11961
|
+
var _d = React.useState(0),
|
|
11962
|
+
modelDownloadProgress = _d[0],
|
|
11963
|
+
setModelDownloadProgress = _d[1];
|
|
11964
|
+
var _e = React.useState(null),
|
|
11965
|
+
modelWarmingStartedAt = _e[0],
|
|
11966
|
+
setModelWarmingStartedAt = _e[1];
|
|
11967
|
+
var _f = React.useState(null),
|
|
11968
|
+
modelError = _f[0],
|
|
11969
|
+
setModelError = _f[1];
|
|
11970
|
+
React.useEffect(function loadModel() {
|
|
11971
|
+
var _this = this;
|
|
11972
|
+
setModelLoadState('downloading');
|
|
11973
|
+
setModelWarmingStartedAt(null);
|
|
11974
|
+
var modelLoadTimeout = setTimeout(function () {
|
|
11975
|
+
setModelError(new Error('Model loading time limit exceeded.'));
|
|
11976
|
+
}, modelLoadTimeoutMs);
|
|
11977
|
+
function handleDownloadProgress(event) {
|
|
11978
|
+
setModelDownloadProgress(progressToPercentage(event.detail));
|
|
11979
|
+
}
|
|
11980
|
+
document.addEventListener('idmission.preloadProgress.faceDetection', handleDownloadProgress);
|
|
11981
|
+
var cancelVideoReady = function cancelVideoReady() {};
|
|
11982
|
+
loadFaceDetector().then(function (model) {
|
|
11983
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
11984
|
+
var _a, videoReady, cancel, cancelled;
|
|
11985
|
+
return __generator(this, function (_b) {
|
|
11986
|
+
switch (_b.label) {
|
|
11987
|
+
case 0:
|
|
11988
|
+
setModelDownloadProgress(100);
|
|
11989
|
+
clearTimeout(modelLoadTimeout);
|
|
11990
|
+
setModelLoadState('warming');
|
|
11991
|
+
setModelWarmingStartedAt(performance.now());
|
|
11992
|
+
return [4 /*yield*/, testFaceDetectionAgainstKnownImage(model)];
|
|
11993
|
+
case 1:
|
|
11994
|
+
_b.sent();
|
|
11995
|
+
_a = waitForVideoReady(videoRef), videoReady = _a[0], cancel = _a[1];
|
|
11996
|
+
cancelled = false;
|
|
11997
|
+
cancelVideoReady = function cancelVideoReady() {
|
|
11998
|
+
cancelled = true;
|
|
11999
|
+
cancel();
|
|
12000
|
+
};
|
|
12001
|
+
return [4 /*yield*/, videoReady];
|
|
12002
|
+
case 2:
|
|
12003
|
+
_b.sent();
|
|
12004
|
+
if (cancelled) return [2 /*return*/];
|
|
12005
|
+
model.detectForVideo(videoRef.current, performance.now());
|
|
12006
|
+
setModelLoadState('ready');
|
|
12007
|
+
return [2 /*return*/];
|
|
12008
|
+
}
|
|
12009
|
+
});
|
|
12010
|
+
});
|
|
12011
|
+
})["catch"](function (e) {
|
|
12012
|
+
setModelError(e);
|
|
12013
|
+
setModelLoadState('error');
|
|
12014
|
+
})["finally"](function () {
|
|
12015
|
+
clearTimeout(modelLoadTimeout);
|
|
12016
|
+
});
|
|
12017
|
+
return function () {
|
|
12018
|
+
log('unloading face detection model');
|
|
12019
|
+
cancelVideoReady();
|
|
12020
|
+
closeFaceDetector();
|
|
12021
|
+
clearTimeout(modelLoadTimeout);
|
|
12022
|
+
document.removeEventListener('idmission.preloadProgress.faceDetection', handleDownloadProgress);
|
|
12023
|
+
};
|
|
12024
|
+
}, [modelLoadTimeoutMs, videoRef]);
|
|
12025
|
+
React.useEffect(function handleModelError() {
|
|
12026
|
+
if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
|
|
12027
|
+
}, [modelError, onModelError]);
|
|
12028
|
+
return React.useMemo(function () {
|
|
12029
|
+
return {
|
|
12030
|
+
ready: modelLoadState === 'ready',
|
|
12031
|
+
modelLoadState: modelLoadState,
|
|
12032
|
+
modelDownloadProgress: modelDownloadProgress,
|
|
12033
|
+
modelWarmingStartedAt: modelWarmingStartedAt,
|
|
12034
|
+
modelError: modelError
|
|
12035
|
+
};
|
|
12036
|
+
}, [modelLoadState, modelDownloadProgress, modelWarmingStartedAt, modelError]);
|
|
12037
|
+
}
|
|
11909
12038
|
var lastFaceDetectionAt = 0;
|
|
11910
12039
|
var lastFaceDetectionTime = 0;
|
|
11911
12040
|
function setLastFaceDetectionAt(time) {
|
|
@@ -11955,68 +12084,24 @@ function trackFace(face, framesNeeded, frameWidth, frameHeight) {
|
|
|
11955
12084
|
if (lastNNosePairs.length > framesNeeded - 1) lastNNosePairs.length = framesNeeded - 1;
|
|
11956
12085
|
}
|
|
11957
12086
|
}
|
|
11958
|
-
function
|
|
11959
|
-
|
|
11960
|
-
|
|
12087
|
+
function makeFaceDetectorPrediction(imageData) {
|
|
12088
|
+
if (!detector) return null;
|
|
12089
|
+
var prediction = detector.detectForVideo(imageData, performance.now());
|
|
12090
|
+
var faces = prediction.detections.map(function (d) {
|
|
12091
|
+
return {
|
|
12092
|
+
box: convertBoundingBox(d.boundingBox),
|
|
12093
|
+
keypoints: d.keypoints.map(function (k) {
|
|
12094
|
+
var _a;
|
|
12095
|
+
return _assign(_assign({}, k), {
|
|
12096
|
+
x: k.x * imageData.width,
|
|
12097
|
+
y: k.y * imageData.height,
|
|
12098
|
+
name: (_a = k.label) !== null && _a !== void 0 ? _a : ''
|
|
12099
|
+
});
|
|
12100
|
+
})
|
|
12101
|
+
};
|
|
11961
12102
|
});
|
|
11962
|
-
}
|
|
11963
|
-
|
|
11964
|
-
return detection.categories.some(function (c) {
|
|
11965
|
-
return c.categoryName === 'Nose';
|
|
11966
|
-
});
|
|
11967
|
-
}
|
|
11968
|
-
function makeFacePredictionWithDocumentDetector(frame) {
|
|
11969
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
11970
|
-
var prediction, faceDetections, noseDetections, _i, _a, detection, faces, _b, faceDetections_1, d, faceBox, nose, _c, noseDetections_1, n, noseBox, cX, cY;
|
|
11971
|
-
return __generator(this, function (_d) {
|
|
11972
|
-
switch (_d.label) {
|
|
11973
|
-
case 0:
|
|
11974
|
-
return [4 /*yield*/, makeDocumentDetectorPrediction(frame)];
|
|
11975
|
-
case 1:
|
|
11976
|
-
prediction = _d.sent();
|
|
11977
|
-
if (!prediction) return [2 /*return*/, null];
|
|
11978
|
-
faceDetections = [];
|
|
11979
|
-
noseDetections = [];
|
|
11980
|
-
for (_i = 0, _a = prediction.detections; _i < _a.length; _i++) {
|
|
11981
|
-
detection = _a[_i];
|
|
11982
|
-
if (isNoseDetection(detection)) {
|
|
11983
|
-
noseDetections.push(detection);
|
|
11984
|
-
} else if (isFaceDetection(detection)) {
|
|
11985
|
-
faceDetections.push(detection);
|
|
11986
|
-
}
|
|
11987
|
-
}
|
|
11988
|
-
faces = [];
|
|
11989
|
-
for (_b = 0, faceDetections_1 = faceDetections; _b < faceDetections_1.length; _b++) {
|
|
11990
|
-
d = faceDetections_1[_b];
|
|
11991
|
-
faceBox = d.boundingBox;
|
|
11992
|
-
if (!faceBox) continue;
|
|
11993
|
-
nose = null;
|
|
11994
|
-
for (_c = 0, noseDetections_1 = noseDetections; _c < noseDetections_1.length; _c++) {
|
|
11995
|
-
n = noseDetections_1[_c];
|
|
11996
|
-
noseBox = n.boundingBox;
|
|
11997
|
-
if (!noseBox) continue;
|
|
11998
|
-
cX = noseBox.originX + noseBox.width / 2;
|
|
11999
|
-
cY = noseBox.originY + noseBox.height / 2;
|
|
12000
|
-
if (cX >= faceBox.originX && cX <= faceBox.originX + faceBox.width && cY >= faceBox.originY && cY <= faceBox.originY + faceBox.height) {
|
|
12001
|
-
nose = {
|
|
12002
|
-
x: cX,
|
|
12003
|
-
y: cY,
|
|
12004
|
-
name: 'nose'
|
|
12005
|
-
};
|
|
12006
|
-
break;
|
|
12007
|
-
}
|
|
12008
|
-
}
|
|
12009
|
-
faces.push({
|
|
12010
|
-
box: convertBoundingBox(d.boundingBox),
|
|
12011
|
-
keypoints: [null, null, nose, null, null]
|
|
12012
|
-
});
|
|
12013
|
-
}
|
|
12014
|
-
debug('faces', faces);
|
|
12015
|
-
return [2 /*return*/, _assign(_assign({}, prediction), {
|
|
12016
|
-
faces: faces
|
|
12017
|
-
})];
|
|
12018
|
-
}
|
|
12019
|
-
});
|
|
12103
|
+
return _assign(_assign({}, prediction), {
|
|
12104
|
+
faces: faces
|
|
12020
12105
|
});
|
|
12021
12106
|
}
|
|
12022
12107
|
function processFaceDetectorPrediction(_a) {
|
|
@@ -12044,9 +12129,13 @@ function processFaceDetectorPrediction(_a) {
|
|
|
12044
12129
|
// this represents the edge that the centroid of the face should not cross -- 12.5% of video width
|
|
12045
12130
|
yCentroidBoundary = _h === void 0 ? 0.125 : _h,
|
|
12046
12131
|
// this represents the edge that the centroid of the face should not cross -- 12.5% of video height
|
|
12047
|
-
_j = _a.
|
|
12132
|
+
_j = _a.foreheadRatio,
|
|
12048
12133
|
// this represents the edge that the centroid of the face should not cross -- 12.5% of video height
|
|
12049
|
-
|
|
12134
|
+
foreheadRatio = _j === void 0 ? 0.275 : _j,
|
|
12135
|
+
// we found that the bounding box ends at the brow and misses the forehead. this ratio represents how much we should extend the box to include the forehead.
|
|
12136
|
+
_k = _a.noseTrackingThreshold,
|
|
12137
|
+
// we found that the bounding box ends at the brow and misses the forehead. this ratio represents how much we should extend the box to include the forehead.
|
|
12138
|
+
noseTrackingThreshold = _k === void 0 ? 0.2 : _k,
|
|
12050
12139
|
// this represents the maximum distance that the nose can be from the center of the face box -- 20% of the face box width or height
|
|
12051
12140
|
minCaptureBrightnessThreshold = _a.minCaptureBrightnessThreshold,
|
|
12052
12141
|
minCaptureRangeThreshold = _a.minCaptureRangeThreshold,
|
|
@@ -12073,10 +12162,10 @@ function processFaceDetectorPrediction(_a) {
|
|
|
12073
12162
|
var frameCX = videoWidth / 2;
|
|
12074
12163
|
var frameCY = videoHeight / 2;
|
|
12075
12164
|
// calculate head bounding box, with forehead extension
|
|
12076
|
-
|
|
12165
|
+
var foreheadSize = face.box.height * foreheadRatio;
|
|
12077
12166
|
var headXMin = face.box.xMin;
|
|
12078
12167
|
var headXMax = face.box.xMax;
|
|
12079
|
-
var headYMin = face.box.yMin
|
|
12168
|
+
var headYMin = face.box.yMin - foreheadSize;
|
|
12080
12169
|
var headYMax = face.box.yMax;
|
|
12081
12170
|
// calculate head centroids
|
|
12082
12171
|
var headCX = (headXMin + headXMax) / 2;
|
|
@@ -12132,6 +12221,26 @@ function processFaceDetectorPrediction(_a) {
|
|
|
12132
12221
|
faceVisibilityTooLow: faceVisibilityTooLow
|
|
12133
12222
|
};
|
|
12134
12223
|
}
|
|
12224
|
+
function testFaceDetectionAgainstKnownImage(detector) {
|
|
12225
|
+
return new Promise(function (resolve, reject) {
|
|
12226
|
+
var img = new Image();
|
|
12227
|
+
img.crossOrigin = 'anonymous';
|
|
12228
|
+
img.onload = function () {
|
|
12229
|
+
var prediction = detector.detectForVideo(img, performance.now());
|
|
12230
|
+
if (prediction.detections.length > 0) {
|
|
12231
|
+
debug('face detection test result', prediction.detections);
|
|
12232
|
+
resolve(void 0);
|
|
12233
|
+
} else {
|
|
12234
|
+
warn('face detection test failed');
|
|
12235
|
+
reject(new Error('testFaceDetectionAgainstKnownImage failed to predict'));
|
|
12236
|
+
}
|
|
12237
|
+
};
|
|
12238
|
+
img.onerror = function () {
|
|
12239
|
+
return reject(new Error('testFaceDetectionAgainstKnownImage failed to load image'));
|
|
12240
|
+
};
|
|
12241
|
+
img.src = "".concat(DEFAULT_CDN_URL, "/head-test.jpg");
|
|
12242
|
+
});
|
|
12243
|
+
}
|
|
12135
12244
|
|
|
12136
12245
|
function detectBrightnessAndContrast(frame, brightnessAverager) {
|
|
12137
12246
|
var ctx = frame.getContext('2d');
|
|
@@ -12283,27 +12392,16 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
12283
12392
|
var canvasRef = React.useRef(null);
|
|
12284
12393
|
var onPredictionHandler = React.useRef();
|
|
12285
12394
|
var addToAverage = useRunningAvg(5).addToAverage;
|
|
12286
|
-
var _f =
|
|
12287
|
-
videoRef: videoRef,
|
|
12395
|
+
var _f = useLoadFaceDetector({
|
|
12288
12396
|
onModelError: onModelError,
|
|
12289
|
-
modelLoadTimeoutMs: modelLoadTimeoutMs
|
|
12397
|
+
modelLoadTimeoutMs: modelLoadTimeoutMs,
|
|
12398
|
+
videoRef: videoRef
|
|
12290
12399
|
}),
|
|
12291
12400
|
ready = _f.ready,
|
|
12292
12401
|
modelLoadState = _f.modelLoadState,
|
|
12293
12402
|
modelDownloadProgress = _f.modelDownloadProgress,
|
|
12294
12403
|
modelWarmingStartedAt = _f.modelWarmingStartedAt,
|
|
12295
12404
|
modelError = _f.modelError;
|
|
12296
|
-
// const {
|
|
12297
|
-
// ready,
|
|
12298
|
-
// modelLoadState,
|
|
12299
|
-
// modelDownloadProgress,
|
|
12300
|
-
// modelWarmingStartedAt,
|
|
12301
|
-
// modelError,
|
|
12302
|
-
// } = useLoadFaceDetector({
|
|
12303
|
-
// onModelError,
|
|
12304
|
-
// modelLoadTimeoutMs,
|
|
12305
|
-
// videoRef,
|
|
12306
|
-
// })
|
|
12307
12405
|
var _g = useFrameLoop(React.useCallback(function () {
|
|
12308
12406
|
return __awaiter(_this, void 0, void 0, function () {
|
|
12309
12407
|
var vw, vh, ctx, thresholdsProvided, brightnessResults, brightness, range, variance, prediction, processed, e_1;
|
|
@@ -12317,21 +12415,19 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
12317
12415
|
ctx = canvasRef.current.getContext('2d');
|
|
12318
12416
|
canvasRef.current.width = vw;
|
|
12319
12417
|
canvasRef.current.height = vh;
|
|
12320
|
-
if (!(ctx && videoRef.current.readyState === 4)) return [3 /*break*/,
|
|
12418
|
+
if (!(ctx && videoRef.current.readyState === 4)) return [3 /*break*/, 4];
|
|
12321
12419
|
ctx.translate(vw, 0);
|
|
12322
12420
|
ctx.scale(-1, 1);
|
|
12323
12421
|
ctx.drawImage(videoRef.current, 0, 0, vw, vh);
|
|
12324
12422
|
_c.label = 1;
|
|
12325
12423
|
case 1:
|
|
12326
|
-
_c.trys.push([1,
|
|
12424
|
+
_c.trys.push([1, 3,, 4]);
|
|
12327
12425
|
thresholdsProvided = minCaptureBrightnessThreshold !== undefined || minCaptureRangeThreshold !== undefined || minCaptureVarianceThreshold !== undefined;
|
|
12328
12426
|
brightnessResults = thresholdsProvided ? detectBrightnessAndContrast(canvasRef.current, addToAverage) : undefined;
|
|
12329
12427
|
brightness = brightnessResults === null || brightnessResults === void 0 ? void 0 : brightnessResults.brightness;
|
|
12330
12428
|
range = brightnessResults === null || brightnessResults === void 0 ? void 0 : brightnessResults.range;
|
|
12331
12429
|
variance = brightnessResults === null || brightnessResults === void 0 ? void 0 : brightnessResults.variance;
|
|
12332
|
-
|
|
12333
|
-
case 2:
|
|
12334
|
-
prediction = _c.sent();
|
|
12430
|
+
prediction = makeFaceDetectorPrediction(canvasRef.current);
|
|
12335
12431
|
processed = processFaceDetectorPrediction({
|
|
12336
12432
|
faces: (_a = prediction === null || prediction === void 0 ? void 0 : prediction.faces) !== null && _a !== void 0 ? _a : [],
|
|
12337
12433
|
videoWidth: vw,
|
|
@@ -12347,15 +12443,15 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
12347
12443
|
setLastFaceDetectionAt(new Date().getTime());
|
|
12348
12444
|
// setLastPrediction(processed)
|
|
12349
12445
|
return [4 /*yield*/, (_b = onPredictionHandler.current) === null || _b === void 0 ? void 0 : _b.call(onPredictionHandler, processed)];
|
|
12350
|
-
case
|
|
12446
|
+
case 2:
|
|
12351
12447
|
// setLastPrediction(processed)
|
|
12352
12448
|
_c.sent();
|
|
12353
|
-
return [3 /*break*/,
|
|
12354
|
-
case
|
|
12449
|
+
return [3 /*break*/, 4];
|
|
12450
|
+
case 3:
|
|
12355
12451
|
e_1 = _c.sent();
|
|
12356
12452
|
error('caught face detection error', e_1);
|
|
12357
|
-
return [3 /*break*/,
|
|
12358
|
-
case
|
|
12453
|
+
return [3 /*break*/, 4];
|
|
12454
|
+
case 4:
|
|
12359
12455
|
return [2 /*return*/];
|
|
12360
12456
|
}
|
|
12361
12457
|
});
|
|
@@ -14892,8 +14988,7 @@ function VideoSignatureCaptureComponent(_a, ref) {
|
|
|
14892
14988
|
var rightEdge = videoWidth * (1 - headTrackingBoundaryPercentage);
|
|
14893
14989
|
var topEdge = videoHeight * headTrackingBoundaryPercentage;
|
|
14894
14990
|
var bottomEdge = videoHeight * (1 - headTrackingBoundaryPercentage);
|
|
14895
|
-
var
|
|
14896
|
-
var nearBoundary = !!face && !!nose && (headTrackingBoundaryType === 'nose' ? nose.x < leftEdge || nose.x > rightEdge || nose.y < topEdge || nose.y > bottomEdge : (face === null || face === void 0 ? void 0 : face.box.xMin) < leftEdge || (face === null || face === void 0 ? void 0 : face.box.xMax) > rightEdge || (face === null || face === void 0 ? void 0 : face.box.yMin) < topEdge || (face === null || face === void 0 ? void 0 : face.box.yMax) > bottomEdge);
|
|
14991
|
+
var nearBoundary = !!face && (headTrackingBoundaryType === 'nose' ? face.keypoints[2].x < leftEdge || face.keypoints[2].x > rightEdge || face.keypoints[2].y < topEdge || face.keypoints[2].y > bottomEdge : (face === null || face === void 0 ? void 0 : face.box.xMin) < leftEdge || (face === null || face === void 0 ? void 0 : face.box.xMax) > rightEdge || (face === null || face === void 0 ? void 0 : face.box.yMin) < topEdge || (face === null || face === void 0 ? void 0 : face.box.yMax) > bottomEdge);
|
|
14897
14992
|
setLastFace(face);
|
|
14898
14993
|
setHeadTrackingSatisfied(!!face && !nearBoundary);
|
|
14899
14994
|
setNumFramesWithoutFaces(face ? 0 : function (n) {
|