3DiVi Face SDK  3.24.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups
LivenessEstimator.h
Go to the documentation of this file.
1 
9 #ifndef __PBIO_API__PBIO__LIVENESS_ESTIMATOR_H_
10 #define __PBIO_API__PBIO__LIVENESS_ESTIMATOR_H_
11 
12 #include <sstream>
13 #include <vector>
14 
15 
16 #include "ComplexObject.h"
17 #include "RawSample.h"
18 #include "SmartPtr.h"
19 #include "Error.h"
20 #include "stl_wraps_impls/WrapOStreamImpl.h"
21 
22 
23 namespace pbio
24 {
25 
26 class FacerecService;
27 
33 class LivenessEstimator : public ComplexObject
34 {
35 public:
36 
42  typedef LightSmartPtr<LivenessEstimator>::tPtr Ptr;
43 
49  enum Liveness
50  {
57 
63  REAL = 1,
64 
70  FAKE = 2
71  };
72 
73 
74 
90  void addSample(const pbio::RawSample&);
91 
92 
109 
110 private:
111 
113  const DHPtr &dll_handle,
114  void* impl);
115 
116  friend class FacerecService;
117  friend class object_with_ref_counter<LivenessEstimator>;
118 };
119 
120 } // pbio namespace
121 
122 
123 
127 
128 namespace pbio
129 {
130 
131 
132 inline
133 LivenessEstimator::LivenessEstimator(
134  const DHPtr &dll_handle,
135  void* impl):
136 ComplexObject(dll_handle, impl)
137 {
138  // nothing else
139 }
140 
141 
142 inline
144 {
145  void* exception = NULL;
146 
147  const int result = _dll_handle->LivenessEstimator_estimateLiveness(
148  _impl,
149  &exception);
150 
151  checkException(exception, *_dll_handle);
152 
153  if(result == 1)
154  return REAL;
155 
156  if(result == 2)
157  return FAKE;
158 
159  return NOT_ENOUGH_DATA;
160 }
161 
162 
163 
164 inline
166 {
167  void* exception = NULL;
168 
169  _dll_handle->LivenessEstimator_addSample(
170  _impl,
171  (pbio::facerec::RawSampleImpl const*) sample._impl,
172  &exception);
173 
174  checkException(exception, *_dll_handle);
175 }
176 
177 
178 } // pbio namespace
179 
180 #endif // __PBIO_API__PBIO__LIVENESS_ESTIMATOR_H_
Interface object for creating other interface objects.
Definition: FacerecService.h:64
Interface object used to estimate face liveness to prevent spoofing attacks.
Definition: LivenessEstimator.h:33
Interface object that stores a captured face sample.
Definition: RawSample.h:49
Not enough information.
Definition: LivenessEstimator.h:56
Error - the class of exceptions thrown when errors occur.
The observed face is taken from a photo.
Definition: LivenessEstimator.h:70
void addSample(const pbio::RawSample &)
Add a sample of the observed face from the new frame.
Definition: LivenessEstimator.h:165
SmartPtr.
Definition: FacerecService.mm:79
LightSmartPtr< LivenessEstimator >::tPtr Ptr
Alias for the type of a smart pointer to LivenessEstimator.
Definition: LivenessEstimator.h:42
Liveness
Estimated liveness.
Definition: LivenessEstimator.h:49
Liveness estimateLiveness()
Estimate liveness of the observed face.
Definition: LivenessEstimator.h:143
The observed face belongs to a living person.
Definition: LivenessEstimator.h:63