3DiVi Face SDK  3.24.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups
AgeGenderEstimator.h
Go to the documentation of this file.
1 
13 #ifndef __PBIO_API__PBIO__AGE_GENDER_ESTIMATOR_H_
14 #define __PBIO_API__PBIO__AGE_GENDER_ESTIMATOR_H_
15 
16 #include <sstream>
17 #include <vector>
18 
19 
20 #include "ComplexObject.h"
21 #include "RawSample.h"
22 #include "SmartPtr.h"
23 #include "Error.h"
24 #include "stl_wraps_impls/WrapOStreamImpl.h"
25 
26 
32 namespace pbio
33 {
34 
35 class FacerecService;
36 
46 class AgeGenderEstimator : public ComplexObject
47 {
48 public:
49 
55  typedef LightSmartPtr<AgeGenderEstimator>::tPtr Ptr;
56 
62  enum Age
63  {
69  AGE_KID = 0,
70 
76  AGE_YOUNG = 1,
77 
83  AGE_ADULT = 2,
84 
91  };
92 
98  enum Gender
99  {
106 
113  };
114 
120  struct AgeGender
121  {
128 
135 
141  float age_years;
142  };
143 
164  AgeGender estimateAgeGender(const pbio::RawSample &sample) const;
165 
166 private:
167 
169  const DHPtr &dll_handle,
170  void* impl);
171 
172  friend class FacerecService;
173  friend class object_with_ref_counter<AgeGenderEstimator>;
174 };
175 
176 } // pbio namespace
177 
178 
179 
183 
184 namespace pbio
185 {
186 
187 inline
188 AgeGenderEstimator::AgeGenderEstimator(
189  const DHPtr &dll_handle,
190  void* impl):
191 ComplexObject(dll_handle, impl)
192 {
193  // nothing else
194 }
195 
196 
197 inline
199 {
200  void* exception = NULL;
201 
202  int32_t age_class, gender;
203  float age_years;
204 
205  _dll_handle->AgeGenderEstimator_estimateAgeGender(
206  _impl,
207  (pbio::facerec::RawSampleImpl const*) sample._impl,
208  &age_class,
209  &gender,
210  &age_years,
211  &exception);
212 
213  checkException(exception, *_dll_handle);
214 
215  AgeGender result;
216  result.age = (Age) age_class;
217  result.gender = (Gender) gender;
218  result.age_years = age_years;
219 
220  return result;
221 }
222 
223 
224 
225 } // pbio namespace
226 
227 #endif // __PBIO_API__PBIO__AGE_GENDER_ESTIMATOR_H_
Gender gender
Gender.
Definition: AgeGenderEstimator.h:134
AgeGender estimateAgeGender(const pbio::RawSample &sample) const
To estimate age and gender of a given face sample.
Definition: AgeGenderEstimator.h:198
Interface object for creating other interface objects.
Definition: FacerecService.h:64
Age in the range of [55; inf) years.
Definition: AgeGenderEstimator.h:90
Interface object that stores a captured face sample.
Definition: RawSample.h:49
Age in the range of [37; 55) years.
Definition: AgeGenderEstimator.h:83
Age age
Age.
Definition: AgeGenderEstimator.h:127
Age
Age groups.
Definition: AgeGenderEstimator.h:62
Age in the range of [0; 18) years.
Definition: AgeGenderEstimator.h:69
Error - the class of exceptions thrown when errors occur.
Age in the range of [18; 37) years.
Definition: AgeGenderEstimator.h:76
Age and gender.
Definition: AgeGenderEstimator.h:120
Interface object for age and gender estimation.
Definition: AgeGenderEstimator.h:46
SmartPtr.
Gender
Gender groups.
Definition: AgeGenderEstimator.h:98
Definition: FacerecService.mm:79
float age_years
Age estmated as number.
Definition: AgeGenderEstimator.h:141
LightSmartPtr< AgeGenderEstimator >::tPtr Ptr
Alias for the type of a smart pointer to AgeGenderEstimator.
Definition: AgeGenderEstimator.h:55
Female.
Definition: AgeGenderEstimator.h:105
Male.
Definition: AgeGenderEstimator.h:112