idmission-web-sdk 0.0.18 → 0.0.19
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/id_capture/IdCaptureModelsProvider.d.ts +34 -1
- package/dist/lib/models/DocumentDetection.d.ts +2 -0
- package/dist/lib/models/Focus.d.ts +2 -0
- package/dist/lib/utils/{cropToShoulders.d.ts → cropping.d.ts} +2 -0
- package/dist/lib/utils/getFrameDimensions.d.ts +2 -0
- package/dist/sdk2.cjs.development.js +6645 -6622
- 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 +6645 -6622
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +6646 -6623
- 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/package.json +1 -1
- package/dist/contexts/IdCaptureModelsContext.d.ts +0 -13
- package/dist/lib/tfworker/Actions.d.ts +0 -30
- package/dist/lib/tfworker/Client.d.ts +0 -14
- package/dist/lib/tfworker/TfWorker.d.ts +0 -8
- package/dist/stories/WebWorker.stories.d.ts +0 -7
|
@@ -1,4 +1,37 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from 'react';
|
|
1
|
+
import React, { MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { DetectedObject } from '../../lib/models/DocumentDetection';
|
|
3
|
+
import { Frame } from '../../lib/utils/getFrameDimensions';
|
|
4
|
+
export type IdCapturePrediction = {
|
|
5
|
+
detectedObjects: DetectedObject[];
|
|
6
|
+
detectionTime: number;
|
|
7
|
+
detectionScore: number;
|
|
8
|
+
detectionThresholdMet: boolean;
|
|
9
|
+
passportDetectionScore: number;
|
|
10
|
+
passportDetectionThresholdMet: boolean;
|
|
11
|
+
bestDocumentOrPassport: DetectedObject | undefined;
|
|
12
|
+
focusScore: number;
|
|
13
|
+
focusThresholdMet: boolean;
|
|
14
|
+
focusPredictionTime: number;
|
|
15
|
+
frameWidth: number;
|
|
16
|
+
frameHeight: number;
|
|
17
|
+
};
|
|
18
|
+
export type IdCaptureModelsState = {
|
|
19
|
+
ready: boolean;
|
|
20
|
+
working: MutableRefObject<boolean>;
|
|
21
|
+
documentDetectionThreshold: number;
|
|
22
|
+
setDocumentDetectionThreshold: (value: number) => void;
|
|
23
|
+
passportDetectionThreshold: number;
|
|
24
|
+
setPassportDetectionThreshold: (value: number) => void;
|
|
25
|
+
focusThreshold: number;
|
|
26
|
+
setFocusThreshold: (value: number) => void;
|
|
27
|
+
makePrediction: (frame: Frame) => void;
|
|
28
|
+
onPredictionMade: (handler: (prediction: IdCapturePrediction) => void) => void;
|
|
29
|
+
detectionTime: number;
|
|
30
|
+
focusPredictionTime: number;
|
|
31
|
+
getBestFrame: () => Promise<Blob | null>;
|
|
32
|
+
resetBestFrame: () => void;
|
|
33
|
+
};
|
|
34
|
+
export declare const IdCaptureModelsContext: React.Context<IdCaptureModelsState>;
|
|
2
35
|
export type IdCaptureModelsProviderProps = {
|
|
3
36
|
children: ReactNode;
|
|
4
37
|
documentDetectionModelUrl?: string | undefined;
|
|
@@ -6,7 +6,9 @@ export declare enum DocumentType {
|
|
|
6
6
|
ID_CARD_BACK = "ID_CARD_BACK",
|
|
7
7
|
PASSPORT = "PASSPORT"
|
|
8
8
|
}
|
|
9
|
+
export declare let documentDetectionModel: tf.GraphModel | null;
|
|
9
10
|
export declare function loadDocumentDetectionModel(url: string): Promise<tf.GraphModel>;
|
|
11
|
+
export declare function unloadDocumentDetectionModel(): void;
|
|
10
12
|
export type RawEdgeDetectionResult = tf.Tensor<tf.Rank>[];
|
|
11
13
|
export declare function makeDocumentDetectionPredictions(model: tf.GraphModel, image: ImageBitmap | ImageData | HTMLImageElement): Promise<[RawEdgeDetectionResult, () => void]>;
|
|
12
14
|
export type DocumentDetectionResults = {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as tf from '@tensorflow/tfjs';
|
|
2
|
+
export declare let focusModel: tf.LayersModel | null;
|
|
2
3
|
export declare function loadFocusModel(url: string): Promise<tf.LayersModel>;
|
|
4
|
+
export declare function unloadFocusModel(): void;
|
|
3
5
|
type BlurScore = number;
|
|
4
6
|
type FocusScore = number;
|
|
5
7
|
export type FocusPrediction = [BlurScore, FocusScore];
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { Face } from '@tensorflow-models/face-detection';
|
|
2
|
+
import { Frame } from './getFrameDimensions';
|
|
2
3
|
export declare function cropToShoulders(frame: ImageBitmap, face: Face): string;
|
|
4
|
+
export declare function cropToBoundingBox(frame: Frame, bbox: number[]): HTMLCanvasElement;
|