3DiVi Face SDK  3.24.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups
Liveness2DEstimator.h
Go to the documentation of this file.
1 
13 #ifndef __PBIO_API__PBIO__LIVENESS_2D_ESTIMATOR_H_
14 #define __PBIO_API__PBIO__LIVENESS_2D_ESTIMATOR_H_
15 
16 #include <sstream>
17 #include <vector>
18 
19 
20 #include "ComplexObject.h"
21 #include "Error.h"
22 #include "RawSample.h"
23 #include "SmartPtr.h"
24 #include "stl_wraps_impls/WrapOStreamImpl.h"
25 
26 
27 namespace pbio
28 {
29 
30 class FacerecService;
31 
41 class Liveness2DEstimator : public ComplexObject
42 {
43 public:
44 
50  typedef LightSmartPtr<Liveness2DEstimator>::tPtr Ptr;
51 
57  enum Liveness
58  {
65 
71  REAL = 1,
72 
78  FAKE = 2,
79 
86 
93 
100 
107 
114 
121 
128 
135 
142 
149 
156  };
157 
164  {
171 
177  float score;
178  };
179 
180 
203 
204 
227 
228 private:
229 
231  const DHPtr &dll_handle,
232  void* impl);
233 
234  friend class FacerecService;
235  friend class object_with_ref_counter<Liveness2DEstimator>;
236 };
237 
238 } // pbio namespace
239 
240 
241 
245 
246 namespace pbio
247 {
248 
249 
250 inline
251 Liveness2DEstimator::Liveness2DEstimator(
252  const DHPtr &dll_handle,
253  void* impl):
254 ComplexObject(dll_handle, impl)
255 {
256  // nothing else
257 }
258 
259 
260 inline
262 {
263  void* exception = NULL;
264  int32_t verdict;
265  float score;
266 
267  _dll_handle->Liveness2DEstimator_estimateLiveness(
268  _impl,
269  (pbio::facerec::RawSampleImpl const*) sample._impl,
270  &verdict,
271  &score,
272  &exception);
273 
274  checkException(exception, *_dll_handle);
275 
276  return static_cast<Liveness>(verdict);
277 }
278 
279 
280 inline
282 {
283  void* exception = NULL;
284  int32_t verdict;
285  float score;
286 
287  _dll_handle->Liveness2DEstimator_estimateLiveness(
288  _impl,
289  (pbio::facerec::RawSampleImpl const*) sample._impl,
290  &verdict,
291  &score,
292  &exception);
293 
294  checkException(exception, *_dll_handle);
295 
296  LivenessAndScore result;
297  result.liveness = static_cast<Liveness>(verdict);
298  result.score = score;
299 
300  return result;
301 }
302 
303 
304 } // pbio namespace
305 
306 #endif // __PBIO_API__PBIO__LIVENESS_2D_ESTIMATOR_H_
Liveness estimateLiveness(const pbio::RawSample &sample)
Estimates liveness of an observed face.
Definition: Liveness2DEstimator.h:261
The observed face belongs to a real person.
Definition: Liveness2DEstimator.h:71
Interface object for creating other interface objects.
Definition: FacerecService.h:64
Liveness
Estimated liveness.
Definition: Liveness2DEstimator.h:57
Interface object used to estimate face liveness in order to prevent spoofing attacks.
Definition: Liveness2DEstimator.h:41
The observed face is not frontal and turned left.
Definition: Liveness2DEstimator.h:113
Interface object that stores a captured face sample.
Definition: RawSample.h:49
The observed face is out of image boundaries.
Definition: Liveness2DEstimator.h:92
LivenessAndScore estimate(const pbio::RawSample &sample)
liveness and score of an observed face.
Definition: Liveness2DEstimator.h:281
Error - the class of exceptions thrown when errors occur.
More than one face detected on the input image.
Definition: Liveness2DEstimator.h:99
The observed face is taken from a photo.
Definition: Liveness2DEstimator.h:78
Input image is too noisy.
Definition: Liveness2DEstimator.h:141
The Observed face is not frontal and turned up.
Definition: Liveness2DEstimator.h:120
The observed face was not checked.
Definition: Liveness2DEstimator.h:85
Not enough information.
Definition: Liveness2DEstimator.h:64
Input image is too flared.
Definition: Liveness2DEstimator.h:155
The Observed face is not frontal and turned down.
Definition: Liveness2DEstimator.h:127
The observed face is not frontal and turned right.
Definition: Liveness2DEstimator.h:106
LightSmartPtr< Liveness2DEstimator >::tPtr Ptr
Alias for the type of a smart pointer to Liveness2DEstimator.
Definition: Liveness2DEstimator.h:50
SmartPtr.
Input image has bad lighting.
Definition: Liveness2DEstimator.h:134
float score
Liveness score.
Definition: Liveness2DEstimator.h:177
Estimated liveness and score.
Definition: Liveness2DEstimator.h:163
Definition: FacerecService.mm:79
Liveness liveness
Estimated liveness (see Liveness for details).
Definition: Liveness2DEstimator.h:170
Input image is too blurry.
Definition: Liveness2DEstimator.h:148