Browse Source

add(face-landmarks): max faces detected config and default value (#11625)

* fix(face-landmarks): set max detected faces up to 4

* add(face-landmarks): config for max faces detected

* fix(config.js): default value for capture interval face-landmarks

* add missing coma
master
Gabriel Borlea 3 years ago
parent
commit
38011e537a
No account linked to committer's email address

+ 6
- 3
config.js View File

779
     // enableEmailInStats: false,
779
     // enableEmailInStats: false,
780
 
780
 
781
     // faceLandmarks: {
781
     // faceLandmarks: {
782
-    //     // Enables sharing your face cordinates. Used for centering faces within a video.
782
+    //     // Enables sharing your face coordinates. Used for centering faces within a video.
783
     //     enableFaceCentering: false,
783
     //     enableFaceCentering: false,
784
 
784
 
785
     //     // Enables detecting face expressions and sharing data with other participants
785
     //     // Enables detecting face expressions and sharing data with other participants
791
     //     // Minimum required face movement percentage threshold for sending new face centering coordinates data.
791
     //     // Minimum required face movement percentage threshold for sending new face centering coordinates data.
792
     //     faceCenteringThreshold: 10,
792
     //     faceCenteringThreshold: 10,
793
 
793
 
794
-    //     // Miliseconds for processing a new image capture in order to detect face coordinates if they exist.
795
-    //     captureInterval: 100
794
+    //     // Milliseconds for processing a new image capture in order to detect face coordinates if they exist.
795
+    //     captureInterval: 1000,
796
+
797
+    //     // Maximum number of faces that can be detected from a video track.
798
+    //     maxFacesDetected: 4
796
     // },
799
     // },
797
 
800
 
798
     // Controls the percentage of automatic feedback shown to participants when callstats is enabled.
801
     // Controls the percentage of automatic feedback shown to participants when callstats is enabled.

+ 13
- 5
react/features/face-landmarks/FaceLandmarksHelper.ts View File

21
 
21
 
22
 type InitInput = {
22
 type InitInput = {
23
     baseUrl: string,
23
     baseUrl: string,
24
-    detectionTypes: string[]
24
+    detectionTypes: string[],
25
+    maxFacesDetected?: number
25
 }
26
 }
26
 
27
 
27
 type DetectOutput = {
28
 type DetectOutput = {
44
     protected human: Human | undefined;
45
     protected human: Human | undefined;
45
     protected faceDetectionTypes: string[];
46
     protected faceDetectionTypes: string[];
46
     protected baseUrl: string;
47
     protected baseUrl: string;
48
+    protected maxFacesDetected?: number;
47
     private detectionInProgress = false;
49
     private detectionInProgress = false;
48
     private lastValidFaceBox: FaceBox | undefined;
50
     private lastValidFaceBox: FaceBox | undefined;
49
     /**
51
     /**
59
         deallocate: true,
61
         deallocate: true,
60
         filter: { enabled: false },
62
         filter: { enabled: false },
61
         face: {
63
         face: {
62
-            enabled: true,
64
+            enabled: false,
63
             detector: {
65
             detector: {
64
                 enabled: false,
66
                 enabled: false,
65
                 rotation: false,
67
                 rotation: false,
66
-                modelPath: 'blazeface-front.json'
68
+                modelPath: 'blazeface-front.json',
69
+                maxDetected: 4
67
             },
70
             },
68
             mesh: { enabled: false },
71
             mesh: { enabled: false },
69
             iris: { enabled: false },
72
             iris: { enabled: false },
79
         segmentation: { enabled: false }
82
         segmentation: { enabled: false }
80
     };
83
     };
81
 
84
 
82
-    constructor({ baseUrl, detectionTypes }: InitInput) {
85
+    constructor({ baseUrl, detectionTypes, maxFacesDetected }: InitInput) {
83
         this.faceDetectionTypes = detectionTypes;
86
         this.faceDetectionTypes = detectionTypes;
84
         this.baseUrl = baseUrl;
87
         this.baseUrl = baseUrl;
88
+        this.maxFacesDetected = maxFacesDetected;
85
         this.init();
89
         this.init();
86
     }
90
     }
87
 
91
 
97
 
101
 
98
             if (this.faceDetectionTypes.length > 0 && this.config.face) {
102
             if (this.faceDetectionTypes.length > 0 && this.config.face) {
99
                 this.config.face.enabled = true
103
                 this.config.face.enabled = true
100
-            } 
104
+            }
105
+            
106
+            if (this.maxFacesDetected && this.config.face?.detector) {
107
+                this.config.face.detector.maxDetected = this.maxFacesDetected;
108
+            }
101
 
109
 
102
             if (this.faceDetectionTypes.includes(DETECTION_TYPES.FACE_BOX) && this.config.face?.detector) {
110
             if (this.faceDetectionTypes.includes(DETECTION_TYPES.FACE_BOX) && this.config.face?.detector) {
103
                 this.config.face.detector.enabled = true;
111
                 this.config.face.detector.enabled = true;

+ 2
- 1
react/features/face-landmarks/actions.js View File

140
         worker.postMessage({
140
         worker.postMessage({
141
             type: INIT_WORKER,
141
             type: INIT_WORKER,
142
             baseUrl,
142
             baseUrl,
143
-            detectionTypes
143
+            detectionTypes,
144
+            maxFacesDetected: faceLandmarks?.maxFacesDetected
144
         });
145
         });
145
 
146
 
146
         dispatch(startFaceLandmarksDetection());
147
         dispatch(startFaceLandmarksDetection());

Loading…
Cancel
Save