9 #ifndef __PBIO_API__PBIO__FACE_ATTRIBUTES_ESTIMATOR_H_
10 #define __PBIO_API__PBIO__FACE_ATTRIBUTES_ESTIMATOR_H_
13 #include "ComplexObject.h"
14 #include "RawSample.h"
37 typedef LightSmartPtr<FaceAttributesEstimator>::tPtr
Ptr;
137 const DHPtr &dll_handle,
157 FaceAttributesEstimator::FaceAttributesEstimator(
158 const DHPtr &dll_handle,
160 ComplexObject(dll_handle, impl)
171 std::ostringstream name_task;
172 pbio::stl_wraps::WrapOStreamImpl name_task_wrap(name_task);
174 void* exception = NULL;
176 _dll_handle->FaceAttributesEstimator_getTaskName(
179 pbio::stl_wraps::WrapOStream::write_func,
182 checkException(exception, *_dll_handle);
184 if (name_task.str() ==
"masked_face" || name_task.str() ==
"masked_face_v2")
188 void* exception = NULL;
190 _dll_handle->FaceAttributesEstimator_estimateMaskedFace(
192 (pbio::facerec::RawSampleImpl
const*) sample._impl,
197 checkException(exception, *_dll_handle);
201 result.mask_attribute = verdict ? Attribute::MaskAttribute::HAS_MASK: Attribute::MaskAttribute::NO_MASK;
203 if (name_task.str() ==
"eyes_openness" || name_task.str() ==
"eyes_openness_v2" )
206 int32_t left_eye_verdict, right_eye_verdict;
208 void* exception = NULL;
210 _dll_handle->FaceAttributesEstimator_estimateEyesOpenness(
212 (pbio::facerec::RawSampleImpl
const*) sample._impl,
215 &result.left_eye_state.
score,
216 &result.right_eye_state.
score,
219 checkException(exception, *_dll_handle);
221 if (result.left_eye_state.
score == -1.f)
222 result.left_eye_state.eye_state = EyeStateScore::NOT_COMPUTED;
224 result.left_eye_state.eye_state = left_eye_verdict ? EyeStateScore::OPENED: EyeStateScore::CLOSED;
226 if (result.right_eye_state.
score == -1.f)
227 result.right_eye_state.eye_state = EyeStateScore::NOT_COMPUTED;
229 result.right_eye_state.eye_state = right_eye_verdict ? EyeStateScore::OPENED: EyeStateScore::CLOSED;
231 PBI0x3dfb4fe3Assert(0xec9eb983,
false,
"FaceAttributesEstimator: unknown name_task: '" + name_task.str() +
"'");
240 #endif // __PBIO_API__PBIO__FACE_ATTRIBUTES_ESTIMATOR_H_
float score
Probability of a required attribute.
Definition: FaceAttributesEstimator.h:88
Interface object for creating other interface objects.
Definition: FacerecService.h:64
Interface object used to estimate attributes of the face.
Definition: FaceAttributesEstimator.h:28
Interface object that stores a captured face sample.
Definition: RawSample.h:49
Attribute()
Estimated left or right eye state and probability of eye opening.
Definition: FaceAttributesEstimator.h:106
MaskAttribute
Detailed description for attribute - medical mask .
Definition: FaceAttributesEstimator.h:95
Attribute estimate(const pbio::RawSample &sample) const
Estimates if there is is a required attribute on a given face sample.
Definition: FaceAttributesEstimator.h:167
The result of determining the presence of the required attribute on the face.
Definition: FaceAttributesEstimator.h:74
float score
Probability of eye opening.
Definition: FaceAttributesEstimator.h:63
Estimated eye state and probability of eye opening.
Definition: FaceAttributesEstimator.h:45
LightSmartPtr< FaceAttributesEstimator >::tPtr Ptr
Alias for the type of a smart pointer to FaceAttributesEstimator.
Definition: FaceAttributesEstimator.h:37
Definition: FacerecService.mm:79
EyeState
Estimated eye state.
Definition: FaceAttributesEstimator.h:52
bool verdict
Verdict.
Definition: FaceAttributesEstimator.h:81