| BestShotMobile Bestshot making and liveness checking library

IBestShotMobile.h
1 #pragma once
2
3 #include "BestShotMobileDefs.h"
4
5 #include <fsdk/FaceEngine.h>
6 #include <tsdk/ITrackEngine.h>
7
8 namespace mobile {
9
13 enum class LivenessType {
14 None = 0,
15 Online = 1,
16 Offline = 2,
17 Offline_OSL = 3
18 };
20
23 enum class LivenessState {
24 Alive,
25 Fake,
26 None,
27 NotReady,
28 BadHeadPose,
29 BadQuality,
30 FaceNotFound,
31 FaceTooClose,
32 FaceCloseToBorder,
33 FaceTooSmall,
34 TooManyFaces,
35 Timeout,
36 CriticalError
37 };
38
41 enum class BestShotState {
42 Ok,
43 BadQuality,
44 BadHeadPose,
45 Error
46 };
47
48 struct BestShotInfo {
50 BestShotState state;
51
53 fsdk::Image image;
55 fsdk::Detection detection;
57 fsdk::Landmarks5 landmarks;
58
61 fsdk::HeadPoseEstimation headPoseEstimation;
64 float agsEstimation;
65
67 tsdk::FrameId frameIndex;
69 tsdk::TrackId trackId;
70 };
71
72 struct IBestShotMobileObserver {
79 BESTSHOT_MOBILE_API virtual void bestShot(
80 const BestShotInfo& bestShotInfo) = 0;
81
88 BESTSHOT_MOBILE_API virtual void liveness(
89 const LivenessState livenessState,
90 const BestShotInfo& bestShotInfo) = 0;
91
96 BESTSHOT_MOBILE_API virtual void trackEnd(
97 const tsdk::TrackId& trackId) = 0;
98 };
99
103 struct IBestShotMobile {
104
105 virtual ~IBestShotMobile() = default;
106
121 BESTSHOT_MOBILE_API virtual bool pushFrame(
122 const fsdk::Image &frame,
123 uint32_t frameId) = 0;
124
128 BESTSHOT_MOBILE_API virtual void setBestShotMobileObserver(
129 IBestShotMobileObserver* observer) = 0;
130
137 BESTSHOT_MOBILE_API virtual void join() = 0;
138
143 BESTSHOT_MOBILE_API virtual LivenessType getLivenessType() = 0;
144 };
145
152 IBestShotMobile* createBestShotMobile(
153 fsdk::FaceEngineType* faceEngine,
154 tsdk::ITrackEngine* trackEngine,
155 fsdk::ISettingsProvider* settings
156 );
157
164 IBestShotMobile* createBestShotMobile(
165 fsdk::FaceEngineType* faceEngine,
166 tsdk::ITrackEngine* trackEngine,
167 const char * configPath
168 );
169
170 } // namespace mobile
mobile::BestShotInfo::landmarks
fsdk::Landmarks5 landmarks
Face landmarks.
Definition: IBestShotMobile.h:57
mobile::IBestShotMobile::setBestShotMobileObserver
virtual BESTSHOT_MOBILE_API void setBestShotMobileObserver(IBestShotMobileObserver *observer)=0
Sets a bestshot observer.
mobile::BestShotInfo::detection
fsdk::Detection detection
Detection with face.
Definition: IBestShotMobile.h:55
mobile::IBestShotMobileObserver::bestShot
virtual BESTSHOT_MOBILE_API void bestShot(const BestShotInfo &bestShotInfo)=0
Bestshot notification.
mobile::BestShotInfo::trackId
tsdk::TrackId trackId
Index of the track.
Definition: IBestShotMobile.h:69
mobile::IBestShotMobile::getLivenessType
virtual BESTSHOT_MOBILE_API LivenessType getLivenessType()=0
Returns current liveness type.
mobile::IBestShotMobileObserver::trackEnd
virtual BESTSHOT_MOBILE_API void trackEnd(const tsdk::TrackId &trackId)=0
End of a track notification.
mobile::BestShotInfo::frameIndex
tsdk::FrameId frameIndex
Index of the frame.
Definition: IBestShotMobile.h:67
mobile::BestShotInfo::headPoseEstimation
fsdk::HeadPoseEstimation headPoseEstimation
Definition: IBestShotMobile.h:61
mobile::BestShotInfo::state
BestShotState state
State of this frame.
Definition: IBestShotMobile.h:50
mobile::IBestShotMobile::pushFrame
virtual BESTSHOT_MOBILE_API bool pushFrame(const fsdk::Image &frame, uint32_t frameId)=0
Pushes a single frame to the buffer.
mobile
Definition: IBestShotMobile.h:8
mobile::IBestShotMobileObserver::liveness
virtual BESTSHOT_MOBILE_API void liveness(const LivenessState livenessState, const BestShotInfo &bestShotInfo)=0
Liveness check notification.
mobile::IBestShotMobile
IBestShotMobile interface class.
Definition: IBestShotMobile.h:103
mobile::IBestShotMobileObserver
Definition: IBestShotMobile.h:72
mobile::BestShotInfo::agsEstimation
float agsEstimation
Definition: IBestShotMobile.h:64
mobile::BestShotInfo
Definition: IBestShotMobile.h:48
mobile::IBestShotMobile::join
virtual BESTSHOT_MOBILE_API void join()=0
Blocks current thread until all frames in this Stream will be handled and all callbacks will be execu...
mobile::BestShotInfo::image
fsdk::Image image
Source image.
Definition: IBestShotMobile.h:53