3DiVi Face SDK  3.24.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups
IRLivenessEstimator.h
Go to the documentation of this file.
1 
9 #ifndef __PBIO_API__PBIO__IR_LIVENESS_ESTIMATOR_H_
10 #define __PBIO_API__PBIO__IR_LIVENESS_ESTIMATOR_H_
11 
12 #include <sstream>
13 #include <vector>
14 
15 
16 #include "ComplexObject.h"
17 #include "IRFrameRaw.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 IRLivenessEstimator : public ComplexObject
35 {
36 public:
37 
43  typedef LightSmartPtr<IRLivenessEstimator>::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::IRFrameRaw ir_frame);
116 
117 private:
118 
120  const DHPtr &dll_handle,
121  void* impl);
122 
123  friend class FacerecService;
124  friend class object_with_ref_counter<IRLivenessEstimator>;
125 };
126 
127 } // pbio namespace
128 
129 
130 
134 
135 namespace pbio
136 {
137 
138 
139 inline
140 IRLivenessEstimator::IRLivenessEstimator(
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::IRFrameRaw ir_frame)
153 {
154  void* exception = NULL;
155 
156  const int result = _dll_handle->IRLivenessEstimator_estimateLiveness(
157  _impl,
158  (pbio::facerec::RawSampleImpl const*) sample._impl,
159  ir_frame.ir_frame_rows,
160  ir_frame.ir_frame_cols,
161  ir_frame.ir_frame_2_image_offset_x,
162  ir_frame.ir_frame_2_image_offset_y,
163  ir_frame.ir_frame_2_image_scale_x,
164  ir_frame.ir_frame_2_image_scale_y,
165  ir_frame.ir_horizontal_fov,
166  ir_frame.ir_vertical_fov,
167  ir_frame.ir_frame_data,
168  ir_frame.ir_data_stride_in_bytes,
169  &exception);
170 
171  checkException(exception, *_dll_handle);
172 
173  if(result == 1)
174  return REAL;
175 
176  if(result == 2)
177  return FAKE;
178 
179  return NOT_ENOUGH_DATA;
180 }
181 
182 
183 } // pbio namespace
184 
185 #endif // __PBIO_API__PBIO__IR_LIVENESS_ESTIMATOR_H_
Liveness
Estimated liveness.
Definition: IRLivenessEstimator.h:50
Interface object for creating other interface objects.
Definition: FacerecService.h:64
Interface object that stores a captured face sample.
Definition: RawSample.h:49
LightSmartPtr< IRLivenessEstimator >::tPtr Ptr
Alias for the type of a smart pointer to IRLivenessEstimator.
Definition: IRLivenessEstimator.h:43
An IR frame aligned with an original color image. Correspondence between the coordinates of the ori...
Definition: IRFrameRaw.h:21
The observed face belongs to a real person.
Definition: IRLivenessEstimator.h:64
float ir_vertical_fov
The vertical viewing angle of an IR frame in degrees.
Definition: IRFrameRaw.h:77
uint16_t const * ir_frame_data
Pointer to IR data.
Definition: IRFrameRaw.h:84
float ir_frame_2_image_offset_x
Parameter of correspondence between the coordinates of an original image and an IR frame...
Definition: IRFrameRaw.h:42
Error - the class of exceptions thrown when errors occur.
Not enough information.
Definition: IRLivenessEstimator.h:57
float ir_horizontal_fov
The horizontal viewing angle of an IR frame in degrees.
Definition: IRFrameRaw.h:70
float ir_frame_2_image_scale_y
Parameter of correspondence between the coordinates of an original image and an IR frame...
Definition: IRFrameRaw.h:63
The observed face is taken from a photo.
Definition: IRLivenessEstimator.h:71
Liveness estimateLiveness(const pbio::RawSample &sample, const pbio::IRFrameRaw ir_frame)
Estimates liveness of an observed face. The given IR map must be synchronized and aligned with the or...
Definition: IRLivenessEstimator.h:150
float ir_frame_2_image_offset_y
Parameter of correspondence between the coordinates of an original image and an IR frame...
Definition: IRFrameRaw.h:49
int32_t ir_data_stride_in_bytes
Stride in bytes.
Definition: IRFrameRaw.h:91
int ir_frame_cols
Width of an IR frame.
Definition: IRFrameRaw.h:35
SmartPtr.
float ir_frame_2_image_scale_x
Parameter of correspondence between the coordinates of an original image and an IR frame...
Definition: IRFrameRaw.h:56
Definition: FacerecService.mm:79
Interface object used to estimate face liveness in order to prevent spoofing attacks.
Definition: IRLivenessEstimator.h:34
int ir_frame_rows
Height of an IR frame.
Definition: IRFrameRaw.h:28
The observed face was not checked.
Definition: IRLivenessEstimator.h:78