react-native-vision-camera-spoof-detector 1.3.2 → 1.3.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.
|
@@ -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/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.3",
|
|
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": {
|