@sssxyd/face-liveness-detector 0.4.0-alpha.2 → 0.4.0-alpha.3

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/index.esm.js CHANGED
@@ -4050,6 +4050,10 @@ class DetectionState {
4050
4050
  this.completedActions.add(this.currentAction);
4051
4051
  this.currentAction = null;
4052
4052
  }
4053
+ setCVInstance(cvInstance) {
4054
+ this.motionDetector?.setCVInstance(cvInstance);
4055
+ this.screenDetector?.setCVInstance(cvInstance);
4056
+ }
4053
4057
  /**
4054
4058
  * Clear action verify timeout
4055
4059
  */
@@ -4129,6 +4133,7 @@ class FaceDetectionEngine extends SimpleEventEmitter {
4129
4133
  }
4130
4134
  this.options = mergeOptions(options);
4131
4135
  this.detectionState = createDetectionState(this.options);
4136
+ this.detectionState.setCVInstance(this.cv);
4132
4137
  }
4133
4138
  getEngineState() {
4134
4139
  return this.engineState;
@@ -4167,10 +4172,8 @@ class FaceDetectionEngine extends SimpleEventEmitter {
4167
4172
  console.log('[FaceDetectionEngine] OpenCV loaded successfully', {
4168
4173
  version: cv_version
4169
4174
  });
4170
- // Inject OpenCV instance into motion detector
4171
- if (this.detectionState.motionDetector) {
4172
- this.detectionState.motionDetector.cv = cv;
4173
- }
4175
+ // Inject OpenCV instance into motion detector and screen detector
4176
+ this.detectionState.setCVInstance(this.cv);
4174
4177
  // Load Human.js
4175
4178
  console.log('[FaceDetectionEngine] Loading Human.js models...');
4176
4179
  this.emitDebug('initialization', 'Loading Human.js...');