소스 검색

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 년 전
부모
커밋
38011e537a
No account linked to committer's email address
3개의 변경된 파일21개의 추가작업 그리고 9개의 파일을 삭제
  1. 6
    3
      config.js
  2. 13
    5
      react/features/face-landmarks/FaceLandmarksHelper.ts
  3. 2
    1
      react/features/face-landmarks/actions.js

+ 6
- 3
config.js 파일 보기

@@ -779,7 +779,7 @@ var config = {
779 779
     // enableEmailInStats: false,
780 780
 
781 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 783
     //     enableFaceCentering: false,
784 784
 
785 785
     //     // Enables detecting face expressions and sharing data with other participants
@@ -791,8 +791,11 @@ var config = {
791 791
     //     // Minimum required face movement percentage threshold for sending new face centering coordinates data.
792 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 801
     // Controls the percentage of automatic feedback shown to participants when callstats is enabled.

+ 13
- 5
react/features/face-landmarks/FaceLandmarksHelper.ts 파일 보기

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

+ 2
- 1
react/features/face-landmarks/actions.js 파일 보기

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

Loading…
취소
저장