3DiVi Face SDK  3.24.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups
DepthLivenessEstimator.h
Go to the documentation of this file.
1 
9 #ifndef __PBIO_API__PBIO__DEPTH_LIVENESS_ESTIMATOR_H_
10 #define __PBIO_API__PBIO__DEPTH_LIVENESS_ESTIMATOR_H_
11 
12 #include <sstream>
13 #include <vector>
14 
15 
16 #include "ComplexObject.h"
17 #include "DepthMapRaw.h"
18 #include "Error.h"
19 #include "RawSample.h"
20 #include "SmartPtr.h"
21 #include "stl_wraps_impls/WrapOStreamImpl.h"
22 
23 
24 namespace pbio
25 {
26 
27 class FacerecService;
28 
34 class DepthLivenessEstimator : public ComplexObject
35 {
36 public:
37 
43  typedef LightSmartPtr<DepthLivenessEstimator>::tPtr Ptr;
44 
50  enum Liveness
51  {
58 
64  REAL = 1,
65 
71  FAKE = 2,
72 
79  };
80 
81 
114  const pbio::RawSample& sample,
115  const pbio::DepthMapRaw depth_map);
116 
117 private:
118 
120  const DHPtr &dll_handle,
121  void* impl);
122 
123  friend class FacerecService;
124  friend class object_with_ref_counter<DepthLivenessEstimator>;
125 };
126 
127 } // pbio namespace
128 
129 
130 
134 
135 namespace pbio
136 {
137 
138 
139 inline
140 DepthLivenessEstimator::DepthLivenessEstimator(
141  const DHPtr &dll_handle,
142  void* impl):
143 ComplexObject(dll_handle, impl)
144 {
145  // nothing else
146 }
147 
148 
149 inline
151  const pbio::RawSample& sample,
152  const pbio::DepthMapRaw depth_map)
153 {
154  void* exception = NULL;
155 
156  const int result = _dll_handle->DepthLivenessEstimator_estimateLiveness(
157  _impl,
158  (pbio::facerec::RawSampleImpl const*) sample._impl,
159  depth_map.depth_map_rows,
160  depth_map.depth_map_cols,
161  depth_map.depth_map_2_image_offset_y,
162  depth_map.depth_map_2_image_offset_x,
163  depth_map.depth_map_2_image_scale_x,
164  depth_map.depth_map_2_image_scale_y,
165  depth_map.horizontal_fov,
166  depth_map.vertical_fov,
167  depth_map.depth_unit_in_millimeters,
168  depth_map.depth_data,
169  depth_map.depth_data_stride_in_bytes,
170  &exception);
171 
172  checkException(exception, *_dll_handle);
173 
174  if(result == 1)
175  return REAL;
176 
177  if(result == 2)
178  return FAKE;
179 
180  return NOT_ENOUGH_DATA;
181 }
182 
183 
184 } // pbio namespace
185 
186 #endif // __PBIO_API__PBIO__DEPTH_LIVENESS_ESTIMATOR_H_
float depth_map_2_image_scale_x
Parameter of correspondence between the coordinates of the original image and depth map...
Definition: DepthMapRaw.h:56
Interface object for creating other interface objects.
Definition: FacerecService.h:64
float depth_unit_in_millimeters
Scale of values stored in the depth_data.
Definition: DepthMapRaw.h:84
int depth_data_stride_in_bytes
Stride in bytes.
Definition: DepthMapRaw.h:98
Interface object that stores a captured face sample.
Definition: RawSample.h:49
float horizontal_fov
The horizontal viewing angle of the depth map in degrees.
Definition: DepthMapRaw.h:70
int depth_map_cols
Width of the depth map.
Definition: DepthMapRaw.h:35
The observed face is taken from a photo.
Definition: DepthLivenessEstimator.h:71
Interface object used to estimate face liveness in order to prevent spoofing attacks.
Definition: DepthLivenessEstimator.h:34
float depth_map_2_image_offset_y
Parameter of correspondence between the coordinates of the original image and depth map...
Definition: DepthMapRaw.h:49
The observed face belongs to a real person.
Definition: DepthLivenessEstimator.h:64
int depth_map_rows
Height of the depth map.
Definition: DepthMapRaw.h:28
Error - the class of exceptions thrown when errors occur.
Liveness estimateLiveness(const pbio::RawSample &sample, const pbio::DepthMapRaw depth_map)
Estimates liveness of the observed face. The given depth map must be synchronized and aligned with th...
Definition: DepthLivenessEstimator.h:150
A depth map aligned with the original color image. Correspondence between the coordinates of the or...
Definition: DepthMapRaw.h:21
SmartPtr.
float depth_map_2_image_scale_y
Parameter of correspondence between the coordinates of the original image and depth map...
Definition: DepthMapRaw.h:63
float depth_map_2_image_offset_x
Parameter of correspondence between the coordinates of the original image and depth map...
Definition: DepthMapRaw.h:42
Definition: FacerecService.mm:79
float vertical_fov
The vertical viewing angle of the depth map in degrees.
Definition: DepthMapRaw.h:77
Not enough information.
Definition: DepthLivenessEstimator.h:57
The observed face was not checked.
Definition: DepthLivenessEstimator.h:78
Liveness
Estimated liveness.
Definition: DepthLivenessEstimator.h:50
uint16_t const * depth_data
Pointer to the depth raw data.
Definition: DepthMapRaw.h:91
LightSmartPtr< DepthLivenessEstimator >::tPtr Ptr
Alias for the type of a smart pointer to DepthLivenessEstimator.
Definition: DepthLivenessEstimator.h:43