react-native-vision-camera-spoof-detector 1.3.5 → 1.3.6

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/README.md CHANGED
@@ -161,7 +161,6 @@ Options:
161
161
 
162
162
  ```ts
163
163
  interface UseFaceAntiSpoofFrameOutputOptions {
164
- targetResolution?: { width: number; height: number };
165
164
  antispoofLevel?: number;
166
165
  stableFrames?: number;
167
166
  requiredLiveFrames?: number;
@@ -194,9 +193,8 @@ Default output options on both platforms:
194
193
  | `requiredLiveFrames` | `3` | Consecutive score-passing frames required before notification |
195
194
  | `laplacianThreshold` | `1100` | Minimum Laplacian score for a frame to pass |
196
195
  | `maxNeuralSpoofScore` | `0.1` | Neural scores at or above this value fail the liveness gate |
197
- | `targetResolution` | Camera-selected | Optional requested analysis resolution |
198
196
 
199
- On Android devices identified by the system as low-RAM, and on iOS devices with 4 GB physical memory or less, a requested resolution wider than 640 pixels is scaled down proportionally. With no `targetResolution`, the camera selects the analysis resolution. Android uses YUV frames and ML Kit; iOS uses BGRA frames and Vision. Platform model runtimes and score calculations may differ, so calibrate thresholds on representative devices and presentation-attack data rather than assuming identical score distributions.
197
+ Vision Camera selects the analysis resolution. Android uses YUV frames and ML Kit; iOS uses BGRA frames and Vision. Platform model runtimes and score calculations may differ, so calibrate thresholds on representative devices and presentation-attack data rather than assuming identical score distributions.
200
198
 
201
199
  The brightness and Laplacian checks are image-quality gates, not independent proof of liveness. Threshold defaults are starting points, not validated biometric security thresholds. Evaluate the complete capture flow against bona fide and attack presentations before relying on it in production.
202
200
 
@@ -249,14 +247,14 @@ Result fields:
249
247
  - Uses CameraX `ImageAnalysis`, ML Kit face detection, and the bundled TensorFlow Lite model
250
248
  - Prefers GPU inference, falls back to NNAPI, then CPU
251
249
  - Uses YUV input, a brightness gate, face-size/frame-margin/pose/landmark checks, and a padded, eye-aligned face crop
252
- - Uses `MirrorMode.AUTO` and applies a requested analysis resolution when provided
250
+ - Uses `MirrorMode.AUTO` and Vision Camera's selected analysis resolution
253
251
 
254
252
  ### iOS
255
253
 
256
254
  - Uses `AVCaptureVideoDataOutput`, Apple Vision face/landmark detection, and the bundled TensorFlow Lite model
257
255
  - Uses Metal when available, with CPU fallback
258
256
  - Uses BGRA input, a brightness gate, face-size/frame-margin/pose/landmark checks, and a padded, eye-aligned face crop
259
- - Automatically adjusts video mirroring and only constrains resolution when `targetResolution` is provided
257
+ - Automatically adjusts video mirroring and uses Vision Camera's selected analysis resolution
260
258
 
261
259
  ## Troubleshooting
262
260
 
@@ -3,14 +3,10 @@ package com.margelo.nitro.camera.spoofdetector
3
3
  import android.graphics.Matrix
4
4
  import android.graphics.PointF
5
5
  import android.graphics.RectF
6
- import android.app.ActivityManager
7
- import android.content.Context
8
6
  import androidx.annotation.OptIn
9
7
  import androidx.camera.core.ExperimentalGetImage
10
8
  import androidx.camera.core.ImageAnalysis
11
9
  import androidx.camera.core.ImageProxy
12
- import androidx.camera.core.resolutionselector.ResolutionSelector
13
- import androidx.camera.core.resolutionselector.ResolutionStrategy
14
10
  import com.google.android.gms.tasks.Task
15
11
  import com.google.android.gms.tasks.Tasks
16
12
  import com.google.mlkit.vision.common.InputImage
@@ -68,11 +64,6 @@ class HybridSpoofDetectorOutput(
68
64
  private val requiredLiveFrames = (options.requiredLiveFrames ?: 3.0).toInt().coerceAtLeast(1)
69
65
  private val laplacianThreshold = options.laplacianThreshold ?: 1100.0
70
66
  private val maxNeuralSpoofScore = options.maxNeuralSpoofScore ?: 0.1
71
- private val isLowRamDevice by lazy {
72
- val context = NitroModules.applicationContext
73
- val activityManager = context?.getSystemService(Context.ACTIVITY_SERVICE) as? ActivityManager
74
- activityManager?.isLowRamDevice == true
75
- }
76
67
  private var captured = false
77
68
  private var stableCount = 0
78
69
  private var lastFaceBounds: SpoofDetectedFaceBounds? = null
@@ -92,32 +83,12 @@ class HybridSpoofDetectorOutput(
92
83
  mirrorMode: MirrorMode,
93
84
  config: NativeCameraOutput.Config,
94
85
  ): NativeCameraOutput.PreparedUseCase {
95
- val requestedTarget = options.targetResolution
96
- val target = requestedTarget?.let {
97
- if (isLowRamDevice && it.width > 640.0) {
98
- val scale = 640.0 / it.width
99
- android.util.Size(640, (it.height * scale).toInt().coerceAtLeast(1))
100
- } else {
101
- android.util.Size(it.width.toInt(), it.height.toInt())
102
- }
103
- }
104
- val selector = target?.let {
105
- ResolutionSelector.Builder()
106
- .setResolutionStrategy(
107
- ResolutionStrategy(
108
- it,
109
- ResolutionStrategy.FALLBACK_RULE_CLOSEST_HIGHER_THEN_LOWER,
110
- )
111
- )
112
- .build()
113
- }
114
86
  val analysis = ImageAnalysis.Builder()
115
87
  .setOutputImageFormat(ImageAnalysis.OUTPUT_IMAGE_FORMAT_YUV_420_888)
116
88
  .setTargetRotation(outputOrientation.surfaceRotation)
117
89
  .setOutputImageRotationEnabled(false)
118
90
  .setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
119
91
  .setAllowDroppingLateFrames(true)
120
- .apply { if (selector != null) setResolutionSelector(selector) }
121
92
  .build()
122
93
  return NativeCameraOutput.PreparedUseCase(analysis) {
123
94
  imageAnalysis = analysis
package/index.js CHANGED
@@ -34,7 +34,6 @@ export const useFaceAntiSpoofFrameOutput = ({
34
34
  );
35
35
  return useMemo(
36
36
  () => factory.createSpoofDetectorOutput({
37
- targetResolution: options.targetResolution,
38
37
  antispoofLevel: options.antispoofLevel,
39
38
  stableFrames: options.stableFrames,
40
39
  requiredLiveFrames: options.requiredLiveFrames,
@@ -55,7 +54,6 @@ export const useFaceAntiSpoofFrameOutput = ({
55
54
  }),
56
55
  [
57
56
  factory,
58
- options.targetResolution,
59
57
  options.antispoofLevel,
60
58
  options.stableFrames,
61
59
  options.requiredLiveFrames,
@@ -31,10 +31,6 @@ final class HybridSpoofDetectorOutput: HybridCameraOutputSpec, NativeCameraOutpu
31
31
  private var requiredLiveFrames: Int { max(1, Int(options.requiredLiveFrames ?? 3)) }
32
32
  private var laplacianThreshold: Double { options.laplacianThreshold ?? 1100 }
33
33
  private var maxNeuralSpoofScore: Double { options.maxNeuralSpoofScore ?? 0.1 }
34
- private var isLowMemoryDevice: Bool {
35
- ProcessInfo.processInfo.physicalMemory <= 4 * 1024 * 1024 * 1024
36
- }
37
-
38
34
  let output = AVCaptureVideoDataOutput()
39
35
  let requiresAudioInput = false
40
36
  let requiresDepthFormat = false
@@ -48,24 +44,7 @@ final class HybridSpoofDetectorOutput: HybridCameraOutputSpec, NativeCameraOutpu
48
44
  }
49
45
 
50
46
  var targetResolution: ResolutionRule {
51
- guard let requestedSize = options.targetResolution else {
52
- return .any
53
- }
54
- let requestedResolution = margelo.nitro.camera.Size(
55
- width: requestedSize.width,
56
- height: requestedSize.height
57
- )
58
- let resolution: margelo.nitro.camera.Size
59
- if isLowMemoryDevice && requestedResolution.width > 640 {
60
- let scale = 640 / requestedResolution.width
61
- resolution = margelo.nitro.camera.Size(
62
- width: 640,
63
- height: max(1, (requestedResolution.height * scale).rounded())
64
- )
65
- } else {
66
- resolution = requestedResolution
67
- }
68
- return .closestTo(resolution)
47
+ return .any
69
48
  }
70
49
 
71
50
  init(options: SpoofDetectorOutputOptions) {
@@ -16,10 +16,8 @@
16
16
  #include "JFunc_void_SpoofDetectedFaceBounds_AntiSpoofingResult.hpp"
17
17
  #include "JFunc_void_std__exception_ptr.hpp"
18
18
  #include "JFunc_void_std__vector_SpoofDetectedFace_.hpp"
19
- #include "JSize.hpp"
20
19
  #include "JSpoofDetectedFace.hpp"
21
20
  #include "JSpoofDetectedFaceBounds.hpp"
22
- #include "Size.hpp"
23
21
  #include "SpoofDetectedFace.hpp"
24
22
  #include "SpoofDetectedFaceBounds.hpp"
25
23
  #include <NitroModules/JNICallable.hpp>
@@ -48,8 +46,6 @@ namespace margelo::nitro::camera::spoofdetector {
48
46
  [[nodiscard]]
49
47
  SpoofDetectorOutputOptions toCpp() const {
50
48
  static const auto clazz = javaClassStatic();
51
- static const auto fieldTargetResolution = clazz->getField<JSize>("targetResolution");
52
- jni::local_ref<JSize> targetResolution = this->getFieldValue(fieldTargetResolution);
53
49
  static const auto fieldAntispoofLevel = clazz->getField<jni::JDouble>("antispoofLevel");
54
50
  jni::local_ref<jni::JDouble> antispoofLevel = this->getFieldValue(fieldAntispoofLevel);
55
51
  static const auto fieldStableFrames = clazz->getField<jni::JDouble>("stableFrames");
@@ -69,7 +65,6 @@ namespace margelo::nitro::camera::spoofdetector {
69
65
  static const auto fieldOnError = clazz->getField<JFunc_void_std__exception_ptr::javaobject>("onError");
70
66
  jni::local_ref<JFunc_void_std__exception_ptr::javaobject> onError = this->getFieldValue(fieldOnError);
71
67
  return SpoofDetectorOutputOptions(
72
- targetResolution != nullptr ? std::make_optional(targetResolution->toCpp()) : std::nullopt,
73
68
  antispoofLevel != nullptr ? std::make_optional(antispoofLevel->value()) : std::nullopt,
74
69
  stableFrames != nullptr ? std::make_optional(stableFrames->value()) : std::nullopt,
75
70
  requiredLiveFrames != nullptr ? std::make_optional(requiredLiveFrames->value()) : std::nullopt,
@@ -120,12 +115,11 @@ namespace margelo::nitro::camera::spoofdetector {
120
115
  */
121
116
  [[maybe_unused]]
122
117
  static jni::local_ref<JSpoofDetectorOutputOptions::javaobject> fromCpp(const SpoofDetectorOutputOptions& value) {
123
- using JSignature = JSpoofDetectorOutputOptions(jni::alias_ref<JSize>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<JFunc_void_AntiSpoofingResult::javaobject>, jni::alias_ref<JFunc_void_std__vector_SpoofDetectedFace_::javaobject>, jni::alias_ref<JFunc_void_SpoofDetectedFaceBounds_AntiSpoofingResult::javaobject>, jni::alias_ref<JFunc_void_std__exception_ptr::javaobject>);
118
+ using JSignature = JSpoofDetectorOutputOptions(jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<JFunc_void_AntiSpoofingResult::javaobject>, jni::alias_ref<JFunc_void_std__vector_SpoofDetectedFace_::javaobject>, jni::alias_ref<JFunc_void_SpoofDetectedFaceBounds_AntiSpoofingResult::javaobject>, jni::alias_ref<JFunc_void_std__exception_ptr::javaobject>);
124
119
  static const auto clazz = javaClassStatic();
125
120
  static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
126
121
  return create(
127
122
  clazz,
128
- value.targetResolution.has_value() ? JSize::fromCpp(value.targetResolution.value()) : nullptr,
129
123
  value.antispoofLevel.has_value() ? jni::JDouble::valueOf(value.antispoofLevel.value()) : nullptr,
130
124
  value.stableFrames.has_value() ? jni::JDouble::valueOf(value.stableFrames.value()) : nullptr,
131
125
  value.requiredLiveFrames.has_value() ? jni::JDouble::valueOf(value.requiredLiveFrames.value()) : nullptr,
@@ -18,9 +18,6 @@ import java.util.Objects
18
18
  @DoNotStrip
19
19
  @Keep
20
20
  data class SpoofDetectorOutputOptions(
21
- @DoNotStrip
22
- @Keep
23
- val targetResolution: Size?,
24
21
  @DoNotStrip
25
22
  @Keep
26
23
  val antispoofLevel: Double?,
@@ -52,14 +49,13 @@ data class SpoofDetectorOutputOptions(
52
49
  /**
53
50
  * Create a new instance of SpoofDetectorOutputOptions from Kotlin
54
51
  */
55
- constructor(targetResolution: Size?, antispoofLevel: Double?, stableFrames: Double?, requiredLiveFrames: Double?, laplacianThreshold: Double?, maxNeuralSpoofScore: Double?, onResult: (result: AntiSpoofingResult) -> Unit, onFacesDetected: ((faces: Array<SpoofDetectedFace>) -> Unit)?, onStableFaceDetected: ((face: SpoofDetectedFaceBounds, result: AntiSpoofingResult) -> Unit)?, onError: ((error: Throwable) -> Unit)?):
56
- this(targetResolution, antispoofLevel, stableFrames, requiredLiveFrames, laplacianThreshold, maxNeuralSpoofScore, Func_void_AntiSpoofingResult_java(onResult), onFacesDetected?.let { Func_void_std__vector_SpoofDetectedFace__java(it) }, onStableFaceDetected?.let { Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult_java(it) }, onError?.let { Func_void_std__exception_ptr_java(it) })
52
+ constructor(antispoofLevel: Double?, stableFrames: Double?, requiredLiveFrames: Double?, laplacianThreshold: Double?, maxNeuralSpoofScore: Double?, onResult: (result: AntiSpoofingResult) -> Unit, onFacesDetected: ((faces: Array<SpoofDetectedFace>) -> Unit)?, onStableFaceDetected: ((face: SpoofDetectedFaceBounds, result: AntiSpoofingResult) -> Unit)?, onError: ((error: Throwable) -> Unit)?):
53
+ this(antispoofLevel, stableFrames, requiredLiveFrames, laplacianThreshold, maxNeuralSpoofScore, Func_void_AntiSpoofingResult_java(onResult), onFacesDetected?.let { Func_void_std__vector_SpoofDetectedFace__java(it) }, onStableFaceDetected?.let { Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult_java(it) }, onError?.let { Func_void_std__exception_ptr_java(it) })
57
54
 
58
55
  override fun equals(other: Any?): Boolean {
59
56
  if (this === other) return true
60
57
  if (other !is SpoofDetectorOutputOptions) return false
61
- return Objects.deepEquals(this.targetResolution, other.targetResolution)
62
- && Objects.deepEquals(this.antispoofLevel, other.antispoofLevel)
58
+ return Objects.deepEquals(this.antispoofLevel, other.antispoofLevel)
63
59
  && Objects.deepEquals(this.stableFrames, other.stableFrames)
64
60
  && Objects.deepEquals(this.requiredLiveFrames, other.requiredLiveFrames)
65
61
  && Objects.deepEquals(this.laplacianThreshold, other.laplacianThreshold)
@@ -72,7 +68,6 @@ data class SpoofDetectorOutputOptions(
72
68
 
73
69
  override fun hashCode(): Int {
74
70
  return arrayOf<Any?>(
75
- targetResolution,
76
71
  antispoofLevel,
77
72
  stableFrames,
78
73
  requiredLiveFrames,
@@ -93,8 +88,8 @@ data class SpoofDetectorOutputOptions(
93
88
  @Keep
94
89
  @Suppress("unused")
95
90
  @JvmStatic
96
- private fun fromCpp(targetResolution: Size?, antispoofLevel: Double?, stableFrames: Double?, requiredLiveFrames: Double?, laplacianThreshold: Double?, maxNeuralSpoofScore: Double?, onResult: Func_void_AntiSpoofingResult, onFacesDetected: Func_void_std__vector_SpoofDetectedFace_?, onStableFaceDetected: Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult?, onError: Func_void_std__exception_ptr?): SpoofDetectorOutputOptions {
97
- return SpoofDetectorOutputOptions(targetResolution, antispoofLevel, stableFrames, requiredLiveFrames, laplacianThreshold, maxNeuralSpoofScore, onResult, onFacesDetected, onStableFaceDetected, onError)
91
+ private fun fromCpp(antispoofLevel: Double?, stableFrames: Double?, requiredLiveFrames: Double?, laplacianThreshold: Double?, maxNeuralSpoofScore: Double?, onResult: Func_void_AntiSpoofingResult, onFacesDetected: Func_void_std__vector_SpoofDetectedFace_?, onStableFaceDetected: Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult?, onError: Func_void_std__exception_ptr?): SpoofDetectorOutputOptions {
92
+ return SpoofDetectorOutputOptions(antispoofLevel, stableFrames, requiredLiveFrames, laplacianThreshold, maxNeuralSpoofScore, onResult, onFacesDetected, onStableFaceDetected, onError)
98
93
  }
99
94
  }
100
95
  }
@@ -18,14 +18,8 @@ public extension SpoofDetectorOutputOptions {
18
18
  /**
19
19
  * Create a new instance of `SpoofDetectorOutputOptions`.
20
20
  */
21
- init(targetResolution: Size?, antispoofLevel: Double?, stableFrames: Double?, requiredLiveFrames: Double?, laplacianThreshold: Double?, maxNeuralSpoofScore: Double?, onResult: @escaping (_ result: AntiSpoofingResult) -> Void, onFacesDetected: ((_ faces: [SpoofDetectedFace]) -> Void)?, onStableFaceDetected: ((_ face: SpoofDetectedFaceBounds, _ result: AntiSpoofingResult) -> Void)?, onError: ((_ error: Error) -> Void)?) {
22
- self.init({ () -> bridge.std__optional_Size_ in
23
- if let __unwrappedValue = targetResolution {
24
- return bridge.create_std__optional_Size_(__unwrappedValue)
25
- } else {
26
- return .init()
27
- }
28
- }(), { () -> bridge.std__optional_double_ in
21
+ init(antispoofLevel: Double?, stableFrames: Double?, requiredLiveFrames: Double?, laplacianThreshold: Double?, maxNeuralSpoofScore: Double?, onResult: @escaping (_ result: AntiSpoofingResult) -> Void, onFacesDetected: ((_ faces: [SpoofDetectedFace]) -> Void)?, onStableFaceDetected: ((_ face: SpoofDetectedFaceBounds, _ result: AntiSpoofingResult) -> Void)?, onError: ((_ error: Error) -> Void)?) {
22
+ self.init({ () -> bridge.std__optional_double_ in
29
23
  if let __unwrappedValue = antispoofLevel {
30
24
  return bridge.create_std__optional_double_(__unwrappedValue)
31
25
  } else {
@@ -89,10 +83,6 @@ public extension SpoofDetectorOutputOptions {
89
83
  }
90
84
 
91
85
  @inline(__always)
92
- var targetResolution: Size? {
93
- return self.__targetResolution.value
94
- }
95
-
96
86
  @inline(__always)
97
87
  var antispoofLevel: Double? {
98
88
  return { () -> Double? in
@@ -28,8 +28,6 @@
28
28
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
29
  #endif
30
30
 
31
- // Forward declaration of `Size` to properly resolve imports.
32
- namespace margelo::nitro::camera::spoofdetector { struct Size; }
33
31
  // Forward declaration of `AntiSpoofingResult` to properly resolve imports.
34
32
  namespace margelo::nitro::camera::spoofdetector { struct AntiSpoofingResult; }
35
33
  // Forward declaration of `SpoofDetectedFace` to properly resolve imports.
@@ -37,7 +35,6 @@ namespace margelo::nitro::camera::spoofdetector { struct SpoofDetectedFace; }
37
35
  // Forward declaration of `SpoofDetectedFaceBounds` to properly resolve imports.
38
36
  namespace margelo::nitro::camera::spoofdetector { struct SpoofDetectedFaceBounds; }
39
37
 
40
- #include "Size.hpp"
41
38
  #include <optional>
42
39
  #include "AntiSpoofingResult.hpp"
43
40
  #include <functional>
@@ -53,7 +50,6 @@ namespace margelo::nitro::camera::spoofdetector {
53
50
  */
54
51
  struct SpoofDetectorOutputOptions final {
55
52
  public:
56
- std::optional<Size> targetResolution SWIFT_PRIVATE;
57
53
  std::optional<double> antispoofLevel SWIFT_PRIVATE;
58
54
  std::optional<double> stableFrames SWIFT_PRIVATE;
59
55
  std::optional<double> requiredLiveFrames SWIFT_PRIVATE;
@@ -66,7 +62,7 @@ namespace margelo::nitro::camera::spoofdetector {
66
62
 
67
63
  public:
68
64
  SpoofDetectorOutputOptions() = default;
69
- explicit SpoofDetectorOutputOptions(std::optional<Size> targetResolution, std::optional<double> antispoofLevel, std::optional<double> stableFrames, std::optional<double> requiredLiveFrames, std::optional<double> laplacianThreshold, std::optional<double> maxNeuralSpoofScore, std::function<void(const AntiSpoofingResult& /* result */)> onResult, std::optional<std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)>> onFacesDetected, std::optional<std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)>> onStableFaceDetected, std::optional<std::function<void(const std::exception_ptr& /* error */)>> onError): targetResolution(targetResolution), antispoofLevel(antispoofLevel), stableFrames(stableFrames), requiredLiveFrames(requiredLiveFrames), laplacianThreshold(laplacianThreshold), maxNeuralSpoofScore(maxNeuralSpoofScore), onResult(onResult), onFacesDetected(onFacesDetected), onStableFaceDetected(onStableFaceDetected), onError(onError) {}
65
+ explicit SpoofDetectorOutputOptions(std::optional<double> antispoofLevel, std::optional<double> stableFrames, std::optional<double> requiredLiveFrames, std::optional<double> laplacianThreshold, std::optional<double> maxNeuralSpoofScore, std::function<void(const AntiSpoofingResult& /* result */)> onResult, std::optional<std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)>> onFacesDetected, std::optional<std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)>> onStableFaceDetected, std::optional<std::function<void(const std::exception_ptr& /* error */)>> onError): antispoofLevel(antispoofLevel), stableFrames(stableFrames), requiredLiveFrames(requiredLiveFrames), laplacianThreshold(laplacianThreshold), maxNeuralSpoofScore(maxNeuralSpoofScore), onResult(onResult), onFacesDetected(onFacesDetected), onStableFaceDetected(onStableFaceDetected), onError(onError) {}
70
66
 
71
67
  public:
72
68
  // SpoofDetectorOutputOptions is not equatable because these properties are not equatable: onResult, onFacesDetected, onStableFaceDetected, onError
@@ -82,7 +78,6 @@ namespace margelo::nitro {
82
78
  static inline margelo::nitro::camera::spoofdetector::SpoofDetectorOutputOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
83
79
  jsi::Object obj = arg.asObject(runtime);
84
80
  return margelo::nitro::camera::spoofdetector::SpoofDetectorOutputOptions(
85
- JSIConverter<std::optional<margelo::nitro::camera::spoofdetector::Size>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "targetResolution"))),
86
81
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "antispoofLevel"))),
87
82
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stableFrames"))),
88
83
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "requiredLiveFrames"))),
@@ -96,7 +91,6 @@ namespace margelo::nitro {
96
91
  }
97
92
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::camera::spoofdetector::SpoofDetectorOutputOptions& arg) {
98
93
  jsi::Object obj(runtime);
99
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "targetResolution"), JSIConverter<std::optional<margelo::nitro::camera::spoofdetector::Size>>::toJSI(runtime, arg.targetResolution));
100
94
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "antispoofLevel"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.antispoofLevel));
101
95
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "stableFrames"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.stableFrames));
102
96
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "requiredLiveFrames"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.requiredLiveFrames));
@@ -116,7 +110,6 @@ namespace margelo::nitro {
116
110
  if (!nitro::isPlainObject(runtime, obj)) {
117
111
  return false;
118
112
  }
119
- if (!JSIConverter<std::optional<margelo::nitro::camera::spoofdetector::Size>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "targetResolution")))) return false;
120
113
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "antispoofLevel")))) return false;
121
114
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stableFrames")))) return false;
122
115
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "requiredLiveFrames")))) return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-vision-camera-spoof-detector",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "High-performance face anti-spoofing and liveness detection module for React Native Vision Camera. Uses TensorFlow Lite with GPU acceleration and optimized YUV processing.",
5
5
  "homepage": "https://github.com/dpraful/react-native-vision-camera-spoof-detector",
6
6
  "repository": {
@@ -1,4 +1,4 @@
1
- import type { CameraOutput, Size } from 'react-native-vision-camera'
1
+ import type { CameraOutput } from 'react-native-vision-camera'
2
2
  import type { HybridObject } from 'react-native-nitro-modules'
3
3
 
4
4
  export interface AntiSpoofingResult {
@@ -20,7 +20,6 @@ export interface SpoofDetectedFace {
20
20
  }
21
21
 
22
22
  export interface SpoofDetectorOutputOptions {
23
- targetResolution?: Size
24
23
  antispoofLevel?: number
25
24
  stableFrames?: number
26
25
  requiredLiveFrames?: number