react-native-vision-camera-spoof-detector 1.2.9 → 1.2.10
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 +1 -1
- package/ios/HybridSpoofDetectorOutput.swift +14 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -257,6 +257,7 @@ Result fields:
|
|
|
257
257
|
- Uses an `AVCaptureVideoDataOutput` pipeline with a native sample-buffer delegate
|
|
258
258
|
- Converts BGRA pixel buffers to a normalized RGB input for the detector
|
|
259
259
|
- Filters frames using brightness and variance checks before inference
|
|
260
|
+
- Uses automatic camera-output mirroring and only constrains resolution when `targetResolution` is provided
|
|
260
261
|
- Returns the evaluation result through the same `onResult` callback contract
|
|
261
262
|
|
|
262
263
|
## Troubleshooting
|
|
@@ -301,4 +302,3 @@ MIT. See [LICENSE](./LICENSE).
|
|
|
301
302
|
## Author
|
|
302
303
|
|
|
303
304
|
JESCON TECHNOLOGIES PVT LTD
|
|
304
|
-
|
|
@@ -53,9 +53,13 @@ final class HybridSpoofDetectorOutput: HybridCameraOutputSpec, NativeCameraOutpu
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
var targetResolution: ResolutionRule {
|
|
56
|
-
let
|
|
57
|
-
|
|
58
|
-
}
|
|
56
|
+
guard let requestedSize = options.targetResolution else {
|
|
57
|
+
return .any
|
|
58
|
+
}
|
|
59
|
+
let requestedResolution = margelo.nitro.camera.Size(
|
|
60
|
+
width: requestedSize.width,
|
|
61
|
+
height: requestedSize.height
|
|
62
|
+
)
|
|
59
63
|
let resolution: margelo.nitro.camera.Size
|
|
60
64
|
if isLowMemoryDevice && requestedResolution.width > 640 {
|
|
61
65
|
let scale = 640 / requestedResolution.width
|
|
@@ -87,6 +91,7 @@ final class HybridSpoofDetectorOutput: HybridCameraOutputSpec, NativeCameraOutpu
|
|
|
87
91
|
func configure(config: OutputConfiguration) {
|
|
88
92
|
guard let connection = output.connection(with: .video) else { return }
|
|
89
93
|
connection.preferredVideoStabilizationMode = .off
|
|
94
|
+
connection.automaticallyAdjustsVideoMirroring = true
|
|
90
95
|
}
|
|
91
96
|
|
|
92
97
|
func dispose() {
|
|
@@ -155,10 +160,13 @@ final class HybridSpoofDetectorOutput: HybridCameraOutputSpec, NativeCameraOutpu
|
|
|
155
160
|
|
|
156
161
|
do {
|
|
157
162
|
let result = try FaceAntiSpoofManager.process(input: input)
|
|
163
|
+
let isLive = result.neuralNetworkScore < maxNeuralSpoofScore
|
|
164
|
+
&& result.confidence >= antispoofLevel
|
|
165
|
+
&& result.laplacianScore >= laplacianThreshold
|
|
158
166
|
processAntiSpoofResult(
|
|
159
167
|
AntiSpoofingResult(
|
|
160
|
-
isLive:
|
|
161
|
-
label:
|
|
168
|
+
isLive: isLive,
|
|
169
|
+
label: isLive ? "Live Face" : "Spoof Face",
|
|
162
170
|
neuralNetworkScore: result.neuralNetworkScore,
|
|
163
171
|
laplacianScore: result.laplacianScore,
|
|
164
172
|
combinedScore: result.combinedScore,
|
|
@@ -400,7 +408,7 @@ final class HybridSpoofDetectorOutput: HybridCameraOutputSpec, NativeCameraOutpu
|
|
|
400
408
|
box.minY >= marginY, box.maxY <= 1 - marginY,
|
|
401
409
|
box.width >= 0.18, box.height >= 0.18,
|
|
402
410
|
abs(face.yaw?.doubleValue ?? 0) <= 25 * .pi / 180,
|
|
403
|
-
abs(face.
|
|
411
|
+
abs(face.pitch?.doubleValue ?? 0) <= 25 * .pi / 180,
|
|
404
412
|
let landmarks = face.landmarks,
|
|
405
413
|
landmarks.leftEye != nil, landmarks.rightEye != nil,
|
|
406
414
|
landmarks.nose != nil, landmarks.outerLips != nil else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-vision-camera-spoof-detector",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10",
|
|
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": {
|