react-native-vision-camera-spoof-detector 1.1.11 → 1.1.15
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/VisionCameraSpoofDetector.podspec +41 -0
- package/ios/FaceAntiSpoofManager.swift +106 -4
- package/ios/FaceAntiSpoofModule.m +38 -51
- package/ios/HybridSpoofDetectorFactory.swift +10 -0
- package/ios/HybridSpoofDetectorOutput.swift +164 -0
- package/nitro.json +4 -0
- package/nitrogen/generated/ios/VisionCameraSpoofDetector+autolinking.rb +62 -0
- package/nitrogen/generated/ios/VisionCameraSpoofDetector-Swift-Cxx-Bridge.cpp +60 -0
- package/nitrogen/generated/ios/VisionCameraSpoofDetector-Swift-Cxx-Bridge.hpp +151 -0
- package/nitrogen/generated/ios/VisionCameraSpoofDetector-Swift-Cxx-Umbrella.hpp +60 -0
- package/nitrogen/generated/ios/VisionCameraSpoofDetectorAutolinking.mm +33 -0
- package/nitrogen/generated/ios/VisionCameraSpoofDetectorAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridSpoofDetectorFactorySpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridSpoofDetectorFactorySpecSwift.hpp +97 -0
- package/nitrogen/generated/ios/swift/AntiSpoofingResult.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_AntiSpoofingResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridSpoofDetectorFactorySpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridSpoofDetectorFactorySpec_cxx.swift +142 -0
- package/nitrogen/generated/ios/swift/Size.swift +34 -0
- package/nitrogen/generated/ios/swift/SpoofDetectorOutputOptions.swift +74 -0
- package/package.json +8 -3
- package/src/specs/SpoofDetectorFactory.nitro.ts +1 -0
- package/ios/FaceAntiSpoofFrameProcessor.swift +0 -301
- package/ios/FaceAntiSpoofJSI.h +0 -12
- package/ios/FaceAntiSpoofJSI.mm +0 -92
- package/ios/FaceAntiSpoofPluginRegister.m +0 -84
- package/ios/models/FaceAntiSpoofing.tflite +0 -0
- package/react-native-vision-camera-spoof-detector.podspec +0 -22
- /package/{ios/models → lib/assets}/model_spec.json +0 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// VisionCameraSpoofDetector-Swift-Cxx-Bridge.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `AntiSpoofingResult` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::camera::spoofdetector { struct AntiSpoofingResult; }
|
|
13
|
+
// Forward declaration of `HybridCameraOutputSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::camera { class HybridCameraOutputSpec; }
|
|
15
|
+
// Forward declaration of `HybridSpoofDetectorFactorySpec` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::camera::spoofdetector { class HybridSpoofDetectorFactorySpec; }
|
|
17
|
+
// Forward declaration of `Size` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::camera::spoofdetector { struct Size; }
|
|
19
|
+
|
|
20
|
+
// Forward declarations of Swift defined types
|
|
21
|
+
// Forward declaration of `HybridCameraOutputSpec_cxx` to properly resolve imports.
|
|
22
|
+
namespace VisionCamera { class HybridCameraOutputSpec_cxx; }
|
|
23
|
+
// Forward declaration of `HybridSpoofDetectorFactorySpec_cxx` to properly resolve imports.
|
|
24
|
+
namespace VisionCameraSpoofDetector { class HybridSpoofDetectorFactorySpec_cxx; }
|
|
25
|
+
|
|
26
|
+
// Include C++ defined types
|
|
27
|
+
#include "AntiSpoofingResult.hpp"
|
|
28
|
+
#include "HybridSpoofDetectorFactorySpec.hpp"
|
|
29
|
+
#include "Size.hpp"
|
|
30
|
+
#include <NitroModules/Result.hpp>
|
|
31
|
+
#include <VisionCamera/HybridCameraOutputSpec.hpp>
|
|
32
|
+
#include <exception>
|
|
33
|
+
#include <functional>
|
|
34
|
+
#include <memory>
|
|
35
|
+
#include <optional>
|
|
36
|
+
#include <string>
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
40
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
41
|
+
*/
|
|
42
|
+
namespace margelo::nitro::camera::spoofdetector::bridge::swift {
|
|
43
|
+
|
|
44
|
+
// pragma MARK: std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec>
|
|
45
|
+
/**
|
|
46
|
+
* Specialized version of `std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec>`.
|
|
47
|
+
*/
|
|
48
|
+
using std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec_ = std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec>;
|
|
49
|
+
std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec> create_std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
50
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec_(std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec_ cppType);
|
|
51
|
+
|
|
52
|
+
// pragma MARK: std::weak_ptr<margelo::nitro::camera::HybridCameraOutputSpec>
|
|
53
|
+
using std__weak_ptr_margelo__nitro__camera__HybridCameraOutputSpec_ = std::weak_ptr<margelo::nitro::camera::HybridCameraOutputSpec>;
|
|
54
|
+
inline std__weak_ptr_margelo__nitro__camera__HybridCameraOutputSpec_ weakify_std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec_(const std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec>& strong) noexcept { return strong; }
|
|
55
|
+
|
|
56
|
+
// pragma MARK: std::optional<Size>
|
|
57
|
+
/**
|
|
58
|
+
* Specialized version of `std::optional<Size>`.
|
|
59
|
+
*/
|
|
60
|
+
using std__optional_Size_ = std::optional<Size>;
|
|
61
|
+
inline std::optional<Size> create_std__optional_Size_(const Size& value) noexcept {
|
|
62
|
+
return std::optional<Size>(value);
|
|
63
|
+
}
|
|
64
|
+
inline bool has_value_std__optional_Size_(const std::optional<Size>& optional) noexcept {
|
|
65
|
+
return optional.has_value();
|
|
66
|
+
}
|
|
67
|
+
inline Size get_std__optional_Size_(const std::optional<Size>& optional) noexcept {
|
|
68
|
+
return optional.value();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// pragma MARK: std::function<void(const AntiSpoofingResult& /* result */)>
|
|
72
|
+
/**
|
|
73
|
+
* Specialized version of `std::function<void(const AntiSpoofingResult&)>`.
|
|
74
|
+
*/
|
|
75
|
+
using Func_void_AntiSpoofingResult = std::function<void(const AntiSpoofingResult& /* result */)>;
|
|
76
|
+
/**
|
|
77
|
+
* Wrapper class for a `std::function<void(const AntiSpoofingResult& / * result * /)>`, this can be used from Swift.
|
|
78
|
+
*/
|
|
79
|
+
class Func_void_AntiSpoofingResult_Wrapper final {
|
|
80
|
+
public:
|
|
81
|
+
explicit Func_void_AntiSpoofingResult_Wrapper(std::function<void(const AntiSpoofingResult& /* result */)>&& func): _function(std::make_unique<std::function<void(const AntiSpoofingResult& /* result */)>>(std::move(func))) {}
|
|
82
|
+
inline void call(AntiSpoofingResult result) const noexcept {
|
|
83
|
+
_function->operator()(result);
|
|
84
|
+
}
|
|
85
|
+
private:
|
|
86
|
+
std::unique_ptr<std::function<void(const AntiSpoofingResult& /* result */)>> _function;
|
|
87
|
+
} SWIFT_NONCOPYABLE;
|
|
88
|
+
Func_void_AntiSpoofingResult create_Func_void_AntiSpoofingResult(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
89
|
+
inline Func_void_AntiSpoofingResult_Wrapper wrap_Func_void_AntiSpoofingResult(Func_void_AntiSpoofingResult value) noexcept {
|
|
90
|
+
return Func_void_AntiSpoofingResult_Wrapper(std::move(value));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
94
|
+
/**
|
|
95
|
+
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
96
|
+
*/
|
|
97
|
+
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
98
|
+
/**
|
|
99
|
+
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
100
|
+
*/
|
|
101
|
+
class Func_void_std__exception_ptr_Wrapper final {
|
|
102
|
+
public:
|
|
103
|
+
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
|
104
|
+
inline void call(std::exception_ptr error) const noexcept {
|
|
105
|
+
_function->operator()(error);
|
|
106
|
+
}
|
|
107
|
+
private:
|
|
108
|
+
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
109
|
+
} SWIFT_NONCOPYABLE;
|
|
110
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
111
|
+
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
112
|
+
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// pragma MARK: std::optional<std::function<void(const std::exception_ptr& /* error */)>>
|
|
116
|
+
/**
|
|
117
|
+
* Specialized version of `std::optional<std::function<void(const std::exception_ptr& / * error * /)>>`.
|
|
118
|
+
*/
|
|
119
|
+
using std__optional_std__function_void_const_std__exception_ptr_____error______ = std::optional<std::function<void(const std::exception_ptr& /* error */)>>;
|
|
120
|
+
inline std::optional<std::function<void(const std::exception_ptr& /* error */)>> create_std__optional_std__function_void_const_std__exception_ptr_____error______(const std::function<void(const std::exception_ptr& /* error */)>& value) noexcept {
|
|
121
|
+
return std::optional<std::function<void(const std::exception_ptr& /* error */)>>(value);
|
|
122
|
+
}
|
|
123
|
+
inline bool has_value_std__optional_std__function_void_const_std__exception_ptr_____error______(const std::optional<std::function<void(const std::exception_ptr& /* error */)>>& optional) noexcept {
|
|
124
|
+
return optional.has_value();
|
|
125
|
+
}
|
|
126
|
+
inline std::function<void(const std::exception_ptr& /* error */)> get_std__optional_std__function_void_const_std__exception_ptr_____error______(const std::optional<std::function<void(const std::exception_ptr& /* error */)>>& optional) noexcept {
|
|
127
|
+
return optional.value();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// pragma MARK: std::shared_ptr<HybridSpoofDetectorFactorySpec>
|
|
131
|
+
/**
|
|
132
|
+
* Specialized version of `std::shared_ptr<HybridSpoofDetectorFactorySpec>`.
|
|
133
|
+
*/
|
|
134
|
+
using std__shared_ptr_HybridSpoofDetectorFactorySpec_ = std::shared_ptr<HybridSpoofDetectorFactorySpec>;
|
|
135
|
+
std::shared_ptr<HybridSpoofDetectorFactorySpec> create_std__shared_ptr_HybridSpoofDetectorFactorySpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
136
|
+
void* NON_NULL get_std__shared_ptr_HybridSpoofDetectorFactorySpec_(std__shared_ptr_HybridSpoofDetectorFactorySpec_ cppType);
|
|
137
|
+
|
|
138
|
+
// pragma MARK: std::weak_ptr<HybridSpoofDetectorFactorySpec>
|
|
139
|
+
using std__weak_ptr_HybridSpoofDetectorFactorySpec_ = std::weak_ptr<HybridSpoofDetectorFactorySpec>;
|
|
140
|
+
inline std__weak_ptr_HybridSpoofDetectorFactorySpec_ weakify_std__shared_ptr_HybridSpoofDetectorFactorySpec_(const std::shared_ptr<HybridSpoofDetectorFactorySpec>& strong) noexcept { return strong; }
|
|
141
|
+
|
|
142
|
+
// pragma MARK: Result<std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec>>
|
|
143
|
+
using Result_std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec__ = Result<std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec>>;
|
|
144
|
+
inline Result_std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec__ create_Result_std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec__(const std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec>& value) noexcept {
|
|
145
|
+
return Result<std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec>>::withValue(value);
|
|
146
|
+
}
|
|
147
|
+
inline Result_std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec__ create_Result_std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec__(const std::exception_ptr& error) noexcept {
|
|
148
|
+
return Result<std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec>>::withError(error);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
} // namespace margelo::nitro::camera::spoofdetector::bridge::swift
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// VisionCameraSpoofDetector-Swift-Cxx-Umbrella.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `AntiSpoofingResult` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::camera::spoofdetector { struct AntiSpoofingResult; }
|
|
13
|
+
// Forward declaration of `HybridCameraOutputSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::camera { class HybridCameraOutputSpec; }
|
|
15
|
+
// Forward declaration of `HybridSpoofDetectorFactorySpec` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::camera::spoofdetector { class HybridSpoofDetectorFactorySpec; }
|
|
17
|
+
// Forward declaration of `Size` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::camera::spoofdetector { struct Size; }
|
|
19
|
+
// Forward declaration of `SpoofDetectorOutputOptions` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::camera::spoofdetector { struct SpoofDetectorOutputOptions; }
|
|
21
|
+
|
|
22
|
+
// Include C++ defined types
|
|
23
|
+
#include "AntiSpoofingResult.hpp"
|
|
24
|
+
#include "HybridSpoofDetectorFactorySpec.hpp"
|
|
25
|
+
#include "Size.hpp"
|
|
26
|
+
#include "SpoofDetectorOutputOptions.hpp"
|
|
27
|
+
#include <NitroModules/Result.hpp>
|
|
28
|
+
#include <VisionCamera/HybridCameraOutputSpec.hpp>
|
|
29
|
+
#include <exception>
|
|
30
|
+
#include <functional>
|
|
31
|
+
#include <memory>
|
|
32
|
+
#include <optional>
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
// C++ helpers for Swift
|
|
36
|
+
#include "VisionCameraSpoofDetector-Swift-Cxx-Bridge.hpp"
|
|
37
|
+
|
|
38
|
+
// Common C++ types used in Swift
|
|
39
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
40
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
41
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
42
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
43
|
+
|
|
44
|
+
// Forward declarations of Swift defined types
|
|
45
|
+
// Forward declaration of `HybridCameraOutputSpec_cxx` to properly resolve imports.
|
|
46
|
+
namespace VisionCamera { class HybridCameraOutputSpec_cxx; }
|
|
47
|
+
// Forward declaration of `HybridSpoofDetectorFactorySpec_cxx` to properly resolve imports.
|
|
48
|
+
namespace VisionCameraSpoofDetector { class HybridSpoofDetectorFactorySpec_cxx; }
|
|
49
|
+
|
|
50
|
+
// Include Swift defined types
|
|
51
|
+
#if __has_include("VisionCameraSpoofDetector-Swift.h")
|
|
52
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
53
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "VisionCameraSpoofDetector".
|
|
54
|
+
#include "VisionCameraSpoofDetector-Swift.h"
|
|
55
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
56
|
+
#elif __has_include(<VisionCameraSpoofDetector/VisionCameraSpoofDetector-Swift.h>)
|
|
57
|
+
#include <VisionCameraSpoofDetector/VisionCameraSpoofDetector-Swift.h>
|
|
58
|
+
#else
|
|
59
|
+
#error VisionCameraSpoofDetector's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "VisionCameraSpoofDetector", and try building the app first.
|
|
60
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// VisionCameraSpoofDetectorAutolinking.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "VisionCameraSpoofDetector-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridSpoofDetectorFactorySpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface VisionCameraSpoofDetectorAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation VisionCameraSpoofDetectorAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::camera::spoofdetector;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"SpoofDetectorFactory",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridSpoofDetectorFactorySpec> hybridObject = VisionCameraSpoofDetector::VisionCameraSpoofDetectorAutolinking::createSpoofDetectorFactory();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// VisionCameraSpoofDetectorAutolinking.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
12
|
+
public final class VisionCameraSpoofDetectorAutolinking {
|
|
13
|
+
public typealias bridge = margelo.nitro.camera.spoofdetector.bridge.swift
|
|
14
|
+
|
|
15
|
+
public static func createSpoofDetectorFactory() -> bridge.std__shared_ptr_HybridSpoofDetectorFactorySpec_ {
|
|
16
|
+
let hybridObject = HybridSpoofDetectorFactory()
|
|
17
|
+
return { () -> bridge.std__shared_ptr_HybridSpoofDetectorFactorySpec_ in
|
|
18
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
19
|
+
return __cxxWrapped.getCxxPart()
|
|
20
|
+
}()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static func isSpoofDetectorFactoryRecyclable() -> Bool {
|
|
24
|
+
return HybridSpoofDetectorFactory.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSpoofDetectorFactorySpecSwift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridSpoofDetectorFactorySpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::camera::spoofdetector {
|
|
11
|
+
} // namespace margelo::nitro::camera::spoofdetector
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSpoofDetectorFactorySpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridSpoofDetectorFactorySpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridSpoofDetectorFactorySpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace VisionCameraSpoofDetector { class HybridSpoofDetectorFactorySpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `HybridCameraOutputSpec` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::camera { class HybridCameraOutputSpec; }
|
|
17
|
+
// Forward declaration of `SpoofDetectorOutputOptions` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::camera::spoofdetector { struct SpoofDetectorOutputOptions; }
|
|
19
|
+
// Forward declaration of `Size` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::camera::spoofdetector { struct Size; }
|
|
21
|
+
// Forward declaration of `AntiSpoofingResult` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::camera::spoofdetector { struct AntiSpoofingResult; }
|
|
23
|
+
|
|
24
|
+
#include <memory>
|
|
25
|
+
#include <VisionCamera/HybridCameraOutputSpec.hpp>
|
|
26
|
+
#include "SpoofDetectorOutputOptions.hpp"
|
|
27
|
+
#include "Size.hpp"
|
|
28
|
+
#include <optional>
|
|
29
|
+
#include "AntiSpoofingResult.hpp"
|
|
30
|
+
#include <functional>
|
|
31
|
+
#include <string>
|
|
32
|
+
#include <exception>
|
|
33
|
+
|
|
34
|
+
#include "VisionCameraSpoofDetector-Swift-Cxx-Umbrella.hpp"
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::camera::spoofdetector {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The C++ part of HybridSpoofDetectorFactorySpec_cxx.swift.
|
|
40
|
+
*
|
|
41
|
+
* HybridSpoofDetectorFactorySpecSwift (C++) accesses HybridSpoofDetectorFactorySpec_cxx (Swift), and might
|
|
42
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
43
|
+
*
|
|
44
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
45
|
+
* the future, HybridSpoofDetectorFactorySpec_cxx can directly inherit from the C++ class HybridSpoofDetectorFactorySpec
|
|
46
|
+
* to simplify the whole structure and memory management.
|
|
47
|
+
*/
|
|
48
|
+
class HybridSpoofDetectorFactorySpecSwift: public virtual HybridSpoofDetectorFactorySpec {
|
|
49
|
+
public:
|
|
50
|
+
// Constructor from a Swift instance
|
|
51
|
+
explicit HybridSpoofDetectorFactorySpecSwift(const VisionCameraSpoofDetector::HybridSpoofDetectorFactorySpec_cxx& swiftPart):
|
|
52
|
+
HybridObject(HybridSpoofDetectorFactorySpec::TAG),
|
|
53
|
+
_swiftPart(swiftPart) { }
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
// Get the Swift part
|
|
57
|
+
inline VisionCameraSpoofDetector::HybridSpoofDetectorFactorySpec_cxx& getSwiftPart() noexcept {
|
|
58
|
+
return _swiftPart;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
63
|
+
return _swiftPart.getMemorySize();
|
|
64
|
+
}
|
|
65
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
66
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridSpoofDetectorFactorySpecSwift>(other)) {
|
|
67
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
void dispose() noexcept override {
|
|
72
|
+
_swiftPart.dispose();
|
|
73
|
+
}
|
|
74
|
+
std::string toString() override {
|
|
75
|
+
return _swiftPart.toString();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public:
|
|
79
|
+
// Properties
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
public:
|
|
83
|
+
// Methods
|
|
84
|
+
inline std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec> createSpoofDetectorOutput(const SpoofDetectorOutputOptions& options) override {
|
|
85
|
+
auto __result = _swiftPart.createSpoofDetectorOutput(std::forward<decltype(options)>(options));
|
|
86
|
+
if (__result.hasError()) [[unlikely]] {
|
|
87
|
+
std::rethrow_exception(__result.error());
|
|
88
|
+
}
|
|
89
|
+
auto __value = std::move(__result.value());
|
|
90
|
+
return __value;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private:
|
|
94
|
+
VisionCameraSpoofDetector::HybridSpoofDetectorFactorySpec_cxx _swiftPart;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
} // namespace margelo::nitro::camera::spoofdetector
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AntiSpoofingResult.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `AntiSpoofingResult`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias AntiSpoofingResult = margelo.nitro.camera.spoofdetector.AntiSpoofingResult
|
|
14
|
+
|
|
15
|
+
public extension AntiSpoofingResult {
|
|
16
|
+
private typealias bridge = margelo.nitro.camera.spoofdetector.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `AntiSpoofingResult`.
|
|
20
|
+
*/
|
|
21
|
+
init(isLive: Bool, label: String, neuralNetworkScore: Double, laplacianScore: Double, combinedScore: Double, confidence: Double) {
|
|
22
|
+
self.init(isLive, std.string(label), neuralNetworkScore, laplacianScore, combinedScore, confidence)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@inline(__always)
|
|
26
|
+
var isLive: Bool {
|
|
27
|
+
return self.__isLive
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@inline(__always)
|
|
31
|
+
var label: String {
|
|
32
|
+
return String(self.__label)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@inline(__always)
|
|
36
|
+
var neuralNetworkScore: Double {
|
|
37
|
+
return self.__neuralNetworkScore
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@inline(__always)
|
|
41
|
+
var laplacianScore: Double {
|
|
42
|
+
return self.__laplacianScore
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@inline(__always)
|
|
46
|
+
var combinedScore: Double {
|
|
47
|
+
return self.__combinedScore
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@inline(__always)
|
|
51
|
+
var confidence: Double {
|
|
52
|
+
return self.__confidence
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_AntiSpoofingResult.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ result: AntiSpoofingResult) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_AntiSpoofingResult {
|
|
15
|
+
public typealias bridge = margelo.nitro.camera.spoofdetector.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ result: AntiSpoofingResult) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ result: AntiSpoofingResult) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(result: AntiSpoofingResult) -> Void {
|
|
25
|
+
self.closure(result)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_AntiSpoofingResult`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_AntiSpoofingResult>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_AntiSpoofingResult {
|
|
44
|
+
return Unmanaged<Func_void_AntiSpoofingResult>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__exception_ptr.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ error: Error) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__exception_ptr {
|
|
15
|
+
public typealias bridge = margelo.nitro.camera.spoofdetector.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ error: Error) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ error: Error) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(error: std.exception_ptr) -> Void {
|
|
25
|
+
self.closure(RuntimeError.from(cppError: error))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
|
|
44
|
+
return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSpoofDetectorFactorySpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import VisionCamera
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/// See ``HybridSpoofDetectorFactorySpec``
|
|
12
|
+
public protocol HybridSpoofDetectorFactorySpec_protocol: HybridObject {
|
|
13
|
+
// Properties
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Methods
|
|
17
|
+
func createSpoofDetectorOutput(options: SpoofDetectorOutputOptions) throws -> (any HybridCameraOutputSpec)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public extension HybridSpoofDetectorFactorySpec_protocol {
|
|
21
|
+
/// Default implementation of ``HybridObject.toString``
|
|
22
|
+
func toString() -> String {
|
|
23
|
+
return "[HybridObject SpoofDetectorFactory]"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// See ``HybridSpoofDetectorFactorySpec``
|
|
28
|
+
open class HybridSpoofDetectorFactorySpec_base {
|
|
29
|
+
private weak var cxxWrapper: HybridSpoofDetectorFactorySpec_cxx? = nil
|
|
30
|
+
public init() { }
|
|
31
|
+
public func getCxxWrapper() -> HybridSpoofDetectorFactorySpec_cxx {
|
|
32
|
+
#if DEBUG
|
|
33
|
+
guard self is any HybridSpoofDetectorFactorySpec else {
|
|
34
|
+
fatalError("`self` is not a `HybridSpoofDetectorFactorySpec`! Did you accidentally inherit from `HybridSpoofDetectorFactorySpec_base` instead of `HybridSpoofDetectorFactorySpec`?")
|
|
35
|
+
}
|
|
36
|
+
#endif
|
|
37
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
38
|
+
return cxxWrapper
|
|
39
|
+
} else {
|
|
40
|
+
let cxxWrapper = HybridSpoofDetectorFactorySpec_cxx(self as! any HybridSpoofDetectorFactorySpec)
|
|
41
|
+
self.cxxWrapper = cxxWrapper
|
|
42
|
+
return cxxWrapper
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A Swift base-protocol representing the SpoofDetectorFactory HybridObject.
|
|
49
|
+
* Implement this protocol to create Swift-based instances of SpoofDetectorFactory.
|
|
50
|
+
* ```swift
|
|
51
|
+
* class HybridSpoofDetectorFactory : HybridSpoofDetectorFactorySpec {
|
|
52
|
+
* // ...
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
public typealias HybridSpoofDetectorFactorySpec = HybridSpoofDetectorFactorySpec_protocol & HybridSpoofDetectorFactorySpec_base
|