shared-ritm 1.2.121 → 1.2.122
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/shared-ritm.es.js +3535 -3552
- package/dist/shared-ritm.umd.js +137 -137
- package/dist/types/utils/faceApiHelper.d.ts +2 -2
- package/package.json +1 -1
- package/src/utils/faceApiHelper.ts +5 -10
|
@@ -28,9 +28,9 @@ declare class FaceApiHelper {
|
|
|
28
28
|
} | null;
|
|
29
29
|
setStylesForCanvas(canvasContainer: any): void;
|
|
30
30
|
checkFaceInclusion(frame: any, face: any): boolean;
|
|
31
|
-
getFaceDetections(videoRef: any): Promise<faceapi.
|
|
31
|
+
getFaceDetections(videoRef: any, inputSize: number): Promise<never[] | faceapi.WithFaceLandmarks<{
|
|
32
32
|
detection: faceapi.FaceDetection;
|
|
33
|
-
}
|
|
33
|
+
}> | undefined>;
|
|
34
34
|
getCanvas(videoRef: any): HTMLCanvasElement;
|
|
35
35
|
getResizedAndDetection(canvas: any, detections: any, ctx: any, videoWidth: number, videoHeight: number): void;
|
|
36
36
|
getFaceSnapshot(inputImage: any, box: any): Promise<string | null>;
|
package/package.json
CHANGED
|
@@ -71,12 +71,10 @@ class FaceApiHelper {
|
|
|
71
71
|
return faceXmin >= frameXmin && faceXmax <= frameXmax && faceYmin >= frameYmin && faceYmax <= frameYmax
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
async getFaceDetections(videoRef: any) {
|
|
74
|
+
async getFaceDetections(videoRef: any, inputSize: number) {
|
|
75
75
|
if (!videoRef) return []
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
.withFaceLandmarks()
|
|
79
|
-
.withFaceExpressions()
|
|
76
|
+
const options = new faceapi.TinyFaceDetectorOptions({ inputSize })
|
|
77
|
+
return faceapi.detectSingleFace(videoRef, options).withFaceLandmarks(true)
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
getCanvas(videoRef: any) {
|
|
@@ -95,7 +93,7 @@ class FaceApiHelper {
|
|
|
95
93
|
|
|
96
94
|
faceapi.draw.drawDetections(canvas, resized)
|
|
97
95
|
faceapi.draw.drawFaceLandmarks(canvas, resized)
|
|
98
|
-
faceapi.draw.drawFaceExpressions(canvas, resized)
|
|
96
|
+
//faceapi.draw.drawFaceExpressions(canvas, resized)
|
|
99
97
|
}
|
|
100
98
|
|
|
101
99
|
async getFaceSnapshot(inputImage: any, box: any) {
|
|
@@ -116,10 +114,7 @@ class FaceApiHelper {
|
|
|
116
114
|
try {
|
|
117
115
|
await Promise.all([
|
|
118
116
|
faceapi.nets.tinyFaceDetector.loadFromUri('/models'),
|
|
119
|
-
faceapi.nets.
|
|
120
|
-
faceapi.nets.faceRecognitionNet.loadFromUri('/models'),
|
|
121
|
-
faceapi.nets.faceExpressionNet.loadFromUri('/models'),
|
|
122
|
-
//faceapi.nets.ssdMobilenetv1.loadFromUri('/models'),
|
|
117
|
+
faceapi.nets.faceLandmark68TinyNet.loadFromUri('/models'),
|
|
123
118
|
])
|
|
124
119
|
} catch (error) {
|
|
125
120
|
console.error(error)
|