idmission-web-sdk 2.3.163-use-doc-detect-for-face-tracking-new-model-cfd6ae1 → 2.3.163
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 +202 -107
- 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 +203 -108
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +202 -107
- 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 +1 -1
|
@@ -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":"A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EAAE,mBAAmB,CAAA;IAC5B,KAAK,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,MAA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;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;
|
|
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;AAqMD,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,C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M,wBAAwB,GAAG,oBAAoB,GAAG;IAC5D,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;IACb;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,kCAAkC,EAAE,2BAMhD,CAAA;AAED,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,wBAAwB,EACpC,UAAU,EAAE,2BAA2B,EACvC,UAAU,GAAE,2BAAgE,GAC3E,2BAA2B,CAgK7B"}
|
|
@@ -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":"Fa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,MAAM,CAAA;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,iBAAiB,CAAC,EAAE,MAAM,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
|
|
@@ -235,7 +235,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
235
235
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
236
236
|
};
|
|
237
237
|
|
|
238
|
-
var webSdkVersion = '2.3.
|
|
238
|
+
var webSdkVersion = '2.3.163';
|
|
239
239
|
|
|
240
240
|
function getPlatform() {
|
|
241
241
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -911,7 +911,7 @@ function makeValidateSessionRequest(authUrl_1, sessionId_1) {
|
|
|
911
911
|
return __generator(this, function (_a) {
|
|
912
912
|
switch (_a.label) {
|
|
913
913
|
case 0:
|
|
914
|
-
maxRetries =
|
|
914
|
+
maxRetries = 6 // 10 retries resulted in minutes waiting for a possible validation failure. 5 retries is mid 30s which is more reasonable.
|
|
915
915
|
;
|
|
916
916
|
baseDelay = 1000 // 1 second
|
|
917
917
|
;
|
|
@@ -2590,8 +2590,8 @@ function giveUpAfter(maxTime) {
|
|
|
2590
2590
|
|
|
2591
2591
|
var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
|
|
2592
2592
|
|
|
2593
|
-
var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-
|
|
2594
|
-
var defaultDocumentDetectorModelHash = '
|
|
2593
|
+
var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20250815_115859.tflite");
|
|
2594
|
+
var defaultDocumentDetectorModelHash = '64LSaO2ctQsTkGJoZ6Et4v2KH28Fz1ettgkxD+qFg6frxY7ufL9l/lkjw2ljX2cR';
|
|
2595
2595
|
|
|
2596
2596
|
var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
|
|
2597
2597
|
var defaultFocusModelHash = 'HTJNLB7QybtPXIIyUI9oNqW40vE5bgSV5V24R1wXLQHknNEVOSyDQDo/QzRgJ8jb';
|
|
@@ -2908,8 +2908,8 @@ var documentTypeDisplayNames = {
|
|
|
2908
2908
|
singlePage: 'Single page',
|
|
2909
2909
|
none: 'None'
|
|
2910
2910
|
};
|
|
2911
|
-
var detector = null;
|
|
2912
|
-
var detectorSettings = null;
|
|
2911
|
+
var detector$1 = null;
|
|
2912
|
+
var detectorSettings$1 = null;
|
|
2913
2913
|
function loadDocumentDetector() {
|
|
2914
2914
|
return __awaiter(this, arguments, void 0, function (modelAssetPath, scoreThreshold) {
|
|
2915
2915
|
var _a, _b;
|
|
@@ -2922,7 +2922,7 @@ function loadDocumentDetector() {
|
|
|
2922
2922
|
return __generator(this, function (_c) {
|
|
2923
2923
|
switch (_c.label) {
|
|
2924
2924
|
case 0:
|
|
2925
|
-
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];
|
|
2925
|
+
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];
|
|
2926
2926
|
closeDocumentDetector();
|
|
2927
2927
|
return [4 /*yield*/, preloadDocumentDetectorDependencies()];
|
|
2928
2928
|
case 1:
|
|
@@ -2943,20 +2943,20 @@ function loadDocumentDetector() {
|
|
|
2943
2943
|
runningMode: 'VIDEO'
|
|
2944
2944
|
}])];
|
|
2945
2945
|
case 3:
|
|
2946
|
-
detector = _c.sent();
|
|
2947
|
-
detectorSettings = {
|
|
2946
|
+
detector$1 = _c.sent();
|
|
2947
|
+
detectorSettings$1 = {
|
|
2948
2948
|
modelAssetPath: modelAssetPath,
|
|
2949
2949
|
scoreThreshold: scoreThreshold
|
|
2950
2950
|
};
|
|
2951
|
-
return [2 /*return*/, detector];
|
|
2951
|
+
return [2 /*return*/, detector$1];
|
|
2952
2952
|
}
|
|
2953
2953
|
});
|
|
2954
2954
|
});
|
|
2955
2955
|
}
|
|
2956
2956
|
function closeDocumentDetector() {
|
|
2957
|
-
detector === null || detector === void 0 ? void 0 : detector.close();
|
|
2958
|
-
detector = null;
|
|
2959
|
-
detectorSettings = null;
|
|
2957
|
+
detector$1 === null || detector$1 === void 0 ? void 0 : detector$1.close();
|
|
2958
|
+
detector$1 = null;
|
|
2959
|
+
detectorSettings$1 = null;
|
|
2960
2960
|
}
|
|
2961
2961
|
function useLoadDocumentDetector(_a) {
|
|
2962
2962
|
var _b = _a.shouldLoadModels,
|
|
@@ -3057,12 +3057,12 @@ function makeDocumentDetectorPrediction(frame) {
|
|
|
3057
3057
|
return __awaiter(this, void 0, void 0, function () {
|
|
3058
3058
|
var startedAt, prediction, time, frameWidth, frameHeight;
|
|
3059
3059
|
return __generator(this, function (_a) {
|
|
3060
|
-
if (!detector) return [2 /*return*/, null];
|
|
3060
|
+
if (!detector$1) return [2 /*return*/, null];
|
|
3061
3061
|
startedAt = performance.now();
|
|
3062
3062
|
// Detectors can throw errors, for example when using custom URLs that
|
|
3063
3063
|
// contain a model that doesn't provide the expected output.
|
|
3064
3064
|
try {
|
|
3065
|
-
prediction = detector.detectForVideo(frame, performance.now());
|
|
3065
|
+
prediction = detector$1.detectForVideo(frame, performance.now());
|
|
3066
3066
|
time = performance.now() - startedAt;
|
|
3067
3067
|
frameWidth = frame.width;
|
|
3068
3068
|
frameHeight = frame.height;
|
|
@@ -7062,7 +7062,6 @@ function SelfieCaptureFaceKeypoint(_a) {
|
|
|
7062
7062
|
scaledHeight = _c.scaledHeight,
|
|
7063
7063
|
xOffset = _c.xOffset,
|
|
7064
7064
|
yOffset = _c.yOffset;
|
|
7065
|
-
if (!point) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null);
|
|
7066
7065
|
var left, top;
|
|
7067
7066
|
if (horizontal) {
|
|
7068
7067
|
left = point.x / videoWidth * scaledWidth - xOffset;
|
|
@@ -12154,6 +12153,136 @@ var FaceCaptureGuideOverlay = function FaceCaptureGuideOverlay(_a) {
|
|
|
12154
12153
|
var templateObject_1$n, templateObject_2$m;
|
|
12155
12154
|
|
|
12156
12155
|
var defaultSelfieCaptureModelLoadTimeoutMs = 45000;
|
|
12156
|
+
var detector = null;
|
|
12157
|
+
var detectorSettings = null;
|
|
12158
|
+
function loadFaceDetector() {
|
|
12159
|
+
return __awaiter(this, arguments, void 0, function (modelAssetPath) {
|
|
12160
|
+
var _a, _b;
|
|
12161
|
+
if (modelAssetPath === void 0) {
|
|
12162
|
+
modelAssetPath = defaultFaceDetectorModelPath;
|
|
12163
|
+
}
|
|
12164
|
+
return __generator(this, function (_c) {
|
|
12165
|
+
switch (_c.label) {
|
|
12166
|
+
case 0:
|
|
12167
|
+
if (detector && (detectorSettings === null || detectorSettings === void 0 ? void 0 : detectorSettings.modelAssetPath) === modelAssetPath) return [2 /*return*/, detector];
|
|
12168
|
+
closeFaceDetector();
|
|
12169
|
+
return [4 /*yield*/, preloadFaceDetectorDependencies()];
|
|
12170
|
+
case 1:
|
|
12171
|
+
_c.sent();
|
|
12172
|
+
if (modelCapabilities.delegate === 'NONE') {
|
|
12173
|
+
throw new Error('No available delegate for face detector.');
|
|
12174
|
+
}
|
|
12175
|
+
_b = (_a = tasksVision.FaceDetector).createFromOptions;
|
|
12176
|
+
return [4 /*yield*/, tasksVision.FilesetResolver.forVisionTasks(visionTasksBasePath)];
|
|
12177
|
+
case 2:
|
|
12178
|
+
return [4 /*yield*/, _b.apply(_a, [_c.sent(), {
|
|
12179
|
+
// canvas: document.createElement('canvas'),
|
|
12180
|
+
baseOptions: {
|
|
12181
|
+
modelAssetPath: modelAssetPath,
|
|
12182
|
+
delegate: modelCapabilities.delegate
|
|
12183
|
+
},
|
|
12184
|
+
runningMode: 'VIDEO'
|
|
12185
|
+
}])];
|
|
12186
|
+
case 3:
|
|
12187
|
+
detector = _c.sent();
|
|
12188
|
+
detectorSettings = {
|
|
12189
|
+
modelAssetPath: modelAssetPath
|
|
12190
|
+
};
|
|
12191
|
+
return [2 /*return*/, detector];
|
|
12192
|
+
}
|
|
12193
|
+
});
|
|
12194
|
+
});
|
|
12195
|
+
}
|
|
12196
|
+
function closeFaceDetector() {
|
|
12197
|
+
detector === null || detector === void 0 ? void 0 : detector.close();
|
|
12198
|
+
detector = null;
|
|
12199
|
+
detectorSettings = null;
|
|
12200
|
+
}
|
|
12201
|
+
function useLoadFaceDetector(_a) {
|
|
12202
|
+
var onModelError = _a.onModelError,
|
|
12203
|
+
_b = _a.modelLoadTimeoutMs,
|
|
12204
|
+
modelLoadTimeoutMs = _b === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _b,
|
|
12205
|
+
videoRef = _a.videoRef;
|
|
12206
|
+
var _c = React.useState('not-started'),
|
|
12207
|
+
modelLoadState = _c[0],
|
|
12208
|
+
setModelLoadState = _c[1];
|
|
12209
|
+
var _d = React.useState(0),
|
|
12210
|
+
modelDownloadProgress = _d[0],
|
|
12211
|
+
setModelDownloadProgress = _d[1];
|
|
12212
|
+
var _e = React.useState(null),
|
|
12213
|
+
modelWarmingStartedAt = _e[0],
|
|
12214
|
+
setModelWarmingStartedAt = _e[1];
|
|
12215
|
+
var _f = React.useState(null),
|
|
12216
|
+
modelError = _f[0],
|
|
12217
|
+
setModelError = _f[1];
|
|
12218
|
+
React.useEffect(function loadModel() {
|
|
12219
|
+
var _this = this;
|
|
12220
|
+
setModelLoadState('downloading');
|
|
12221
|
+
setModelWarmingStartedAt(null);
|
|
12222
|
+
var modelLoadTimeout = setTimeout(function () {
|
|
12223
|
+
setModelError(new Error('Model loading time limit exceeded.'));
|
|
12224
|
+
}, modelLoadTimeoutMs);
|
|
12225
|
+
function handleDownloadProgress(event) {
|
|
12226
|
+
setModelDownloadProgress(progressToPercentage(event.detail));
|
|
12227
|
+
}
|
|
12228
|
+
document.addEventListener('idmission.preloadProgress.faceDetection', handleDownloadProgress);
|
|
12229
|
+
var cancelVideoReady = function cancelVideoReady() {};
|
|
12230
|
+
loadFaceDetector().then(function (model) {
|
|
12231
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
12232
|
+
var _a, videoReady, cancel, cancelled;
|
|
12233
|
+
return __generator(this, function (_b) {
|
|
12234
|
+
switch (_b.label) {
|
|
12235
|
+
case 0:
|
|
12236
|
+
setModelDownloadProgress(100);
|
|
12237
|
+
clearTimeout(modelLoadTimeout);
|
|
12238
|
+
setModelLoadState('warming');
|
|
12239
|
+
setModelWarmingStartedAt(performance.now());
|
|
12240
|
+
return [4 /*yield*/, testFaceDetectionAgainstKnownImage(model)];
|
|
12241
|
+
case 1:
|
|
12242
|
+
_b.sent();
|
|
12243
|
+
_a = waitForVideoReady(videoRef), videoReady = _a[0], cancel = _a[1];
|
|
12244
|
+
cancelled = false;
|
|
12245
|
+
cancelVideoReady = function cancelVideoReady() {
|
|
12246
|
+
cancelled = true;
|
|
12247
|
+
cancel();
|
|
12248
|
+
};
|
|
12249
|
+
return [4 /*yield*/, videoReady];
|
|
12250
|
+
case 2:
|
|
12251
|
+
_b.sent();
|
|
12252
|
+
if (cancelled) return [2 /*return*/];
|
|
12253
|
+
model.detectForVideo(videoRef.current, performance.now());
|
|
12254
|
+
setModelLoadState('ready');
|
|
12255
|
+
return [2 /*return*/];
|
|
12256
|
+
}
|
|
12257
|
+
});
|
|
12258
|
+
});
|
|
12259
|
+
})["catch"](function (e) {
|
|
12260
|
+
setModelError(e);
|
|
12261
|
+
setModelLoadState('error');
|
|
12262
|
+
})["finally"](function () {
|
|
12263
|
+
clearTimeout(modelLoadTimeout);
|
|
12264
|
+
});
|
|
12265
|
+
return function () {
|
|
12266
|
+
log('unloading face detection model');
|
|
12267
|
+
cancelVideoReady();
|
|
12268
|
+
closeFaceDetector();
|
|
12269
|
+
clearTimeout(modelLoadTimeout);
|
|
12270
|
+
document.removeEventListener('idmission.preloadProgress.faceDetection', handleDownloadProgress);
|
|
12271
|
+
};
|
|
12272
|
+
}, [modelLoadTimeoutMs, videoRef]);
|
|
12273
|
+
React.useEffect(function handleModelError() {
|
|
12274
|
+
if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
|
|
12275
|
+
}, [modelError, onModelError]);
|
|
12276
|
+
return React.useMemo(function () {
|
|
12277
|
+
return {
|
|
12278
|
+
ready: modelLoadState === 'ready',
|
|
12279
|
+
modelLoadState: modelLoadState,
|
|
12280
|
+
modelDownloadProgress: modelDownloadProgress,
|
|
12281
|
+
modelWarmingStartedAt: modelWarmingStartedAt,
|
|
12282
|
+
modelError: modelError
|
|
12283
|
+
};
|
|
12284
|
+
}, [modelLoadState, modelDownloadProgress, modelWarmingStartedAt, modelError]);
|
|
12285
|
+
}
|
|
12157
12286
|
var lastFaceDetectionAt = 0;
|
|
12158
12287
|
var lastFaceDetectionTime = 0;
|
|
12159
12288
|
function setLastFaceDetectionAt(time) {
|
|
@@ -12203,68 +12332,24 @@ function trackFace(face, framesNeeded, frameWidth, frameHeight) {
|
|
|
12203
12332
|
if (lastNNosePairs.length > framesNeeded - 1) lastNNosePairs.length = framesNeeded - 1;
|
|
12204
12333
|
}
|
|
12205
12334
|
}
|
|
12206
|
-
function
|
|
12207
|
-
|
|
12208
|
-
|
|
12209
|
-
|
|
12210
|
-
|
|
12211
|
-
|
|
12212
|
-
|
|
12213
|
-
|
|
12335
|
+
function makeFaceDetectorPrediction(imageData) {
|
|
12336
|
+
if (!detector) return null;
|
|
12337
|
+
var prediction = detector.detectForVideo(imageData, performance.now());
|
|
12338
|
+
var faces = prediction.detections.map(function (d) {
|
|
12339
|
+
return {
|
|
12340
|
+
box: convertBoundingBox(d.boundingBox),
|
|
12341
|
+
keypoints: d.keypoints.map(function (k) {
|
|
12342
|
+
var _a;
|
|
12343
|
+
return _assign(_assign({}, k), {
|
|
12344
|
+
x: k.x * imageData.width,
|
|
12345
|
+
y: k.y * imageData.height,
|
|
12346
|
+
name: (_a = k.label) !== null && _a !== void 0 ? _a : ''
|
|
12347
|
+
});
|
|
12348
|
+
})
|
|
12349
|
+
};
|
|
12214
12350
|
});
|
|
12215
|
-
}
|
|
12216
|
-
|
|
12217
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
12218
|
-
var prediction, faceDetections, noseDetections, _i, _a, detection, faces, _b, faceDetections_1, d, faceBox, nose, _c, noseDetections_1, n, noseBox, cX, cY;
|
|
12219
|
-
return __generator(this, function (_d) {
|
|
12220
|
-
switch (_d.label) {
|
|
12221
|
-
case 0:
|
|
12222
|
-
return [4 /*yield*/, makeDocumentDetectorPrediction(frame)];
|
|
12223
|
-
case 1:
|
|
12224
|
-
prediction = _d.sent();
|
|
12225
|
-
if (!prediction) return [2 /*return*/, null];
|
|
12226
|
-
faceDetections = [];
|
|
12227
|
-
noseDetections = [];
|
|
12228
|
-
for (_i = 0, _a = prediction.detections; _i < _a.length; _i++) {
|
|
12229
|
-
detection = _a[_i];
|
|
12230
|
-
if (isNoseDetection(detection)) {
|
|
12231
|
-
noseDetections.push(detection);
|
|
12232
|
-
} else if (isFaceDetection(detection)) {
|
|
12233
|
-
faceDetections.push(detection);
|
|
12234
|
-
}
|
|
12235
|
-
}
|
|
12236
|
-
faces = [];
|
|
12237
|
-
for (_b = 0, faceDetections_1 = faceDetections; _b < faceDetections_1.length; _b++) {
|
|
12238
|
-
d = faceDetections_1[_b];
|
|
12239
|
-
faceBox = d.boundingBox;
|
|
12240
|
-
if (!faceBox) continue;
|
|
12241
|
-
nose = null;
|
|
12242
|
-
for (_c = 0, noseDetections_1 = noseDetections; _c < noseDetections_1.length; _c++) {
|
|
12243
|
-
n = noseDetections_1[_c];
|
|
12244
|
-
noseBox = n.boundingBox;
|
|
12245
|
-
if (!noseBox) continue;
|
|
12246
|
-
cX = noseBox.originX + noseBox.width / 2;
|
|
12247
|
-
cY = noseBox.originY + noseBox.height / 2;
|
|
12248
|
-
if (cX >= faceBox.originX && cX <= faceBox.originX + faceBox.width && cY >= faceBox.originY && cY <= faceBox.originY + faceBox.height) {
|
|
12249
|
-
nose = {
|
|
12250
|
-
x: cX,
|
|
12251
|
-
y: cY,
|
|
12252
|
-
name: 'nose'
|
|
12253
|
-
};
|
|
12254
|
-
break;
|
|
12255
|
-
}
|
|
12256
|
-
}
|
|
12257
|
-
faces.push({
|
|
12258
|
-
box: convertBoundingBox(d.boundingBox),
|
|
12259
|
-
keypoints: [null, null, nose, null, null]
|
|
12260
|
-
});
|
|
12261
|
-
}
|
|
12262
|
-
debug('faces', faces);
|
|
12263
|
-
return [2 /*return*/, _assign(_assign({}, prediction), {
|
|
12264
|
-
faces: faces
|
|
12265
|
-
})];
|
|
12266
|
-
}
|
|
12267
|
-
});
|
|
12351
|
+
return _assign(_assign({}, prediction), {
|
|
12352
|
+
faces: faces
|
|
12268
12353
|
});
|
|
12269
12354
|
}
|
|
12270
12355
|
function processFaceDetectorPrediction(_a) {
|
|
@@ -12292,9 +12377,13 @@ function processFaceDetectorPrediction(_a) {
|
|
|
12292
12377
|
// this represents the edge that the centroid of the face should not cross -- 12.5% of video width
|
|
12293
12378
|
yCentroidBoundary = _h === void 0 ? 0.125 : _h,
|
|
12294
12379
|
// this represents the edge that the centroid of the face should not cross -- 12.5% of video height
|
|
12295
|
-
_j = _a.
|
|
12380
|
+
_j = _a.foreheadRatio,
|
|
12296
12381
|
// this represents the edge that the centroid of the face should not cross -- 12.5% of video height
|
|
12297
|
-
|
|
12382
|
+
foreheadRatio = _j === void 0 ? 0.275 : _j,
|
|
12383
|
+
// 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.
|
|
12384
|
+
_k = _a.noseTrackingThreshold,
|
|
12385
|
+
// 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.
|
|
12386
|
+
noseTrackingThreshold = _k === void 0 ? 0.2 : _k,
|
|
12298
12387
|
// 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
|
|
12299
12388
|
minCaptureBrightnessThreshold = _a.minCaptureBrightnessThreshold,
|
|
12300
12389
|
minCaptureRangeThreshold = _a.minCaptureRangeThreshold,
|
|
@@ -12321,10 +12410,10 @@ function processFaceDetectorPrediction(_a) {
|
|
|
12321
12410
|
var frameCX = videoWidth / 2;
|
|
12322
12411
|
var frameCY = videoHeight / 2;
|
|
12323
12412
|
// calculate head bounding box, with forehead extension
|
|
12324
|
-
|
|
12413
|
+
var foreheadSize = face.box.height * foreheadRatio;
|
|
12325
12414
|
var headXMin = face.box.xMin;
|
|
12326
12415
|
var headXMax = face.box.xMax;
|
|
12327
|
-
var headYMin = face.box.yMin
|
|
12416
|
+
var headYMin = face.box.yMin - foreheadSize;
|
|
12328
12417
|
var headYMax = face.box.yMax;
|
|
12329
12418
|
// calculate head centroids
|
|
12330
12419
|
var headCX = (headXMin + headXMax) / 2;
|
|
@@ -12380,6 +12469,26 @@ function processFaceDetectorPrediction(_a) {
|
|
|
12380
12469
|
faceVisibilityTooLow: faceVisibilityTooLow
|
|
12381
12470
|
};
|
|
12382
12471
|
}
|
|
12472
|
+
function testFaceDetectionAgainstKnownImage(detector) {
|
|
12473
|
+
return new Promise(function (resolve, reject) {
|
|
12474
|
+
var img = new Image();
|
|
12475
|
+
img.crossOrigin = 'anonymous';
|
|
12476
|
+
img.onload = function () {
|
|
12477
|
+
var prediction = detector.detectForVideo(img, performance.now());
|
|
12478
|
+
if (prediction.detections.length > 0) {
|
|
12479
|
+
debug('face detection test result', prediction.detections);
|
|
12480
|
+
resolve(void 0);
|
|
12481
|
+
} else {
|
|
12482
|
+
warn('face detection test failed');
|
|
12483
|
+
reject(new Error('testFaceDetectionAgainstKnownImage failed to predict'));
|
|
12484
|
+
}
|
|
12485
|
+
};
|
|
12486
|
+
img.onerror = function () {
|
|
12487
|
+
return reject(new Error('testFaceDetectionAgainstKnownImage failed to load image'));
|
|
12488
|
+
};
|
|
12489
|
+
img.src = "".concat(DEFAULT_CDN_URL, "/head-test.jpg");
|
|
12490
|
+
});
|
|
12491
|
+
}
|
|
12383
12492
|
|
|
12384
12493
|
function detectBrightnessAndContrast(frame, brightnessAverager) {
|
|
12385
12494
|
var ctx = frame.getContext('2d');
|
|
@@ -12531,27 +12640,16 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
12531
12640
|
var canvasRef = React.useRef(null);
|
|
12532
12641
|
var onPredictionHandler = React.useRef();
|
|
12533
12642
|
var addToAverage = useRunningAvg(5).addToAverage;
|
|
12534
|
-
var _f =
|
|
12535
|
-
videoRef: videoRef,
|
|
12643
|
+
var _f = useLoadFaceDetector({
|
|
12536
12644
|
onModelError: onModelError,
|
|
12537
|
-
modelLoadTimeoutMs: modelLoadTimeoutMs
|
|
12645
|
+
modelLoadTimeoutMs: modelLoadTimeoutMs,
|
|
12646
|
+
videoRef: videoRef
|
|
12538
12647
|
}),
|
|
12539
12648
|
ready = _f.ready,
|
|
12540
12649
|
modelLoadState = _f.modelLoadState,
|
|
12541
12650
|
modelDownloadProgress = _f.modelDownloadProgress,
|
|
12542
12651
|
modelWarmingStartedAt = _f.modelWarmingStartedAt,
|
|
12543
12652
|
modelError = _f.modelError;
|
|
12544
|
-
// const {
|
|
12545
|
-
// ready,
|
|
12546
|
-
// modelLoadState,
|
|
12547
|
-
// modelDownloadProgress,
|
|
12548
|
-
// modelWarmingStartedAt,
|
|
12549
|
-
// modelError,
|
|
12550
|
-
// } = useLoadFaceDetector({
|
|
12551
|
-
// onModelError,
|
|
12552
|
-
// modelLoadTimeoutMs,
|
|
12553
|
-
// videoRef,
|
|
12554
|
-
// })
|
|
12555
12653
|
var _g = useFrameLoop(React.useCallback(function () {
|
|
12556
12654
|
return __awaiter(_this, void 0, void 0, function () {
|
|
12557
12655
|
var vw, vh, ctx, thresholdsProvided, brightnessResults, brightness, range, variance, prediction, processed, e_1;
|
|
@@ -12565,21 +12663,19 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
12565
12663
|
ctx = canvasRef.current.getContext('2d');
|
|
12566
12664
|
canvasRef.current.width = vw;
|
|
12567
12665
|
canvasRef.current.height = vh;
|
|
12568
|
-
if (!(ctx && videoRef.current.readyState === 4)) return [3 /*break*/,
|
|
12666
|
+
if (!(ctx && videoRef.current.readyState === 4)) return [3 /*break*/, 4];
|
|
12569
12667
|
ctx.translate(vw, 0);
|
|
12570
12668
|
ctx.scale(-1, 1);
|
|
12571
12669
|
ctx.drawImage(videoRef.current, 0, 0, vw, vh);
|
|
12572
12670
|
_c.label = 1;
|
|
12573
12671
|
case 1:
|
|
12574
|
-
_c.trys.push([1,
|
|
12672
|
+
_c.trys.push([1, 3,, 4]);
|
|
12575
12673
|
thresholdsProvided = minCaptureBrightnessThreshold !== undefined || minCaptureRangeThreshold !== undefined || minCaptureVarianceThreshold !== undefined;
|
|
12576
12674
|
brightnessResults = thresholdsProvided ? detectBrightnessAndContrast(canvasRef.current, addToAverage) : undefined;
|
|
12577
12675
|
brightness = brightnessResults === null || brightnessResults === void 0 ? void 0 : brightnessResults.brightness;
|
|
12578
12676
|
range = brightnessResults === null || brightnessResults === void 0 ? void 0 : brightnessResults.range;
|
|
12579
12677
|
variance = brightnessResults === null || brightnessResults === void 0 ? void 0 : brightnessResults.variance;
|
|
12580
|
-
|
|
12581
|
-
case 2:
|
|
12582
|
-
prediction = _c.sent();
|
|
12678
|
+
prediction = makeFaceDetectorPrediction(canvasRef.current);
|
|
12583
12679
|
processed = processFaceDetectorPrediction({
|
|
12584
12680
|
faces: (_a = prediction === null || prediction === void 0 ? void 0 : prediction.faces) !== null && _a !== void 0 ? _a : [],
|
|
12585
12681
|
videoWidth: vw,
|
|
@@ -12595,15 +12691,15 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
12595
12691
|
setLastFaceDetectionAt(new Date().getTime());
|
|
12596
12692
|
// setLastPrediction(processed)
|
|
12597
12693
|
return [4 /*yield*/, (_b = onPredictionHandler.current) === null || _b === void 0 ? void 0 : _b.call(onPredictionHandler, processed)];
|
|
12598
|
-
case
|
|
12694
|
+
case 2:
|
|
12599
12695
|
// setLastPrediction(processed)
|
|
12600
12696
|
_c.sent();
|
|
12601
|
-
return [3 /*break*/,
|
|
12602
|
-
case
|
|
12697
|
+
return [3 /*break*/, 4];
|
|
12698
|
+
case 3:
|
|
12603
12699
|
e_1 = _c.sent();
|
|
12604
12700
|
error('caught face detection error', e_1);
|
|
12605
|
-
return [3 /*break*/,
|
|
12606
|
-
case
|
|
12701
|
+
return [3 /*break*/, 4];
|
|
12702
|
+
case 4:
|
|
12607
12703
|
return [2 /*return*/];
|
|
12608
12704
|
}
|
|
12609
12705
|
});
|
|
@@ -15415,8 +15511,7 @@ function VideoSignatureCaptureComponent(_a, ref) {
|
|
|
15415
15511
|
var rightEdge = videoWidth * (1 - headTrackingBoundaryPercentage);
|
|
15416
15512
|
var topEdge = videoHeight * headTrackingBoundaryPercentage;
|
|
15417
15513
|
var bottomEdge = videoHeight * (1 - headTrackingBoundaryPercentage);
|
|
15418
|
-
var
|
|
15419
|
-
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);
|
|
15514
|
+
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);
|
|
15420
15515
|
setLastFace(face);
|
|
15421
15516
|
setHeadTrackingSatisfied(!!face && !nearBoundary);
|
|
15422
15517
|
setNumFramesWithoutFaces(face ? 0 : function (n) {
|