react-native-vision-camera-spoof-detector 1.3.2 → 1.3.4
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
|
@@ -193,7 +193,7 @@ Default output options on both platforms:
|
|
|
193
193
|
| `antispoofLevel` | `0.4` | Minimum confidence for a frame to count toward the live-frame streak |
|
|
194
194
|
| `stableFrames` | `3` | Eligible face frames required before stable-face notification |
|
|
195
195
|
| `requiredLiveFrames` | `3` | Consecutive score-passing frames required before notification |
|
|
196
|
-
| `laplacianThreshold` | `
|
|
196
|
+
| `laplacianThreshold` | `1100` | Minimum Laplacian score for a frame to pass |
|
|
197
197
|
| `maxNeuralSpoofScore` | `0.1` | Neural scores at or above this value fail the liveness gate |
|
|
198
198
|
| `uiUpdateIntervalMs` | `100` | Minimum interval between score/face updates when the eligible face count is unchanged |
|
|
199
199
|
| `targetResolution` | Camera-selected | Optional requested analysis resolution |
|
|
@@ -403,9 +403,11 @@ class FaceAntiSpoofingAdvanced(private val assetManager: AssetManager) {
|
|
|
403
403
|
|
|
404
404
|
// FROM WORKING VERSION: neuralNetworkAntiSpoofing with Bitmap
|
|
405
405
|
private fun neuralNetworkAntiSpoofing(bitmap: Bitmap): Result<Float> {
|
|
406
|
+
var bitmapScale: Bitmap? = null
|
|
406
407
|
return try {
|
|
407
|
-
val
|
|
408
|
-
|
|
408
|
+
val scaledBitmap = Bitmap.createScaledBitmap(bitmap, INPUT_IMAGE_SIZE, INPUT_IMAGE_SIZE, true)
|
|
409
|
+
bitmapScale = scaledBitmap
|
|
410
|
+
val img = normalizeImage(scaledBitmap)
|
|
409
411
|
val input = arrayOf(img)
|
|
410
412
|
|
|
411
413
|
// Clear and prepare outputs
|
|
@@ -427,9 +429,7 @@ class FaceAntiSpoofingAdvanced(private val assetManager: AssetManager) {
|
|
|
427
429
|
Log.e(TAG, "Error in neuralNetworkAntiSpoofing", e)
|
|
428
430
|
Result.failure(e)
|
|
429
431
|
} finally {
|
|
430
|
-
|
|
431
|
-
bitmapScale.recycle()
|
|
432
|
-
}
|
|
432
|
+
bitmapScale?.takeIf { it !== bitmap }?.recycle()
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
|
package/android/src/main/java/com/margelo/nitro/camera/spoofdetector/HybridSpoofDetectorOutput.kt
CHANGED
|
@@ -67,7 +67,7 @@ class HybridSpoofDetectorOutput(
|
|
|
67
67
|
private val antispoofLevel = options.antispoofLevel ?: 0.4
|
|
68
68
|
private val stableFrames = (options.stableFrames ?: 3.0).toInt().coerceAtLeast(1)
|
|
69
69
|
private val requiredLiveFrames = (options.requiredLiveFrames ?: 3.0).toInt().coerceAtLeast(1)
|
|
70
|
-
private val laplacianThreshold = options.laplacianThreshold ?:
|
|
70
|
+
private val laplacianThreshold = options.laplacianThreshold ?: 1100.0
|
|
71
71
|
private val maxNeuralSpoofScore = options.maxNeuralSpoofScore ?: 0.1
|
|
72
72
|
private val uiUpdateIntervalMs = (options.uiUpdateIntervalMs ?: 100.0).toLong().coerceAtLeast(0L)
|
|
73
73
|
private val isLowRamDevice by lazy {
|
|
@@ -32,7 +32,7 @@ final class HybridSpoofDetectorOutput: HybridCameraOutputSpec, NativeCameraOutpu
|
|
|
32
32
|
private var antispoofLevel: Double { options.antispoofLevel ?? 0.4 }
|
|
33
33
|
private var stableFrames: Int { max(1, Int(options.stableFrames ?? 3)) }
|
|
34
34
|
private var requiredLiveFrames: Int { max(1, Int(options.requiredLiveFrames ?? 3)) }
|
|
35
|
-
private var laplacianThreshold: Double { options.laplacianThreshold ??
|
|
35
|
+
private var laplacianThreshold: Double { options.laplacianThreshold ?? 1100 }
|
|
36
36
|
private var maxNeuralSpoofScore: Double { options.maxNeuralSpoofScore ?? 0.1 }
|
|
37
37
|
private var uiUpdateInterval: Double { max(0, options.uiUpdateIntervalMs ?? 100) / 1000 }
|
|
38
38
|
private var isLowMemoryDevice: Bool {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-vision-camera-spoof-detector",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
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": {
|