3DiVi Face SDK  3.24.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups
QualityEstimator.h
Go to the documentation of this file.
1 
13 #ifndef __PBIO_API__PBIO__QUALITY_ESTIMATOR_H_
14 #define __PBIO_API__PBIO__QUALITY_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 
27 namespace pbio
28 {
29 
30 class FacerecService;
31 
41 class QualityEstimator : public ComplexObject
42 {
43 public:
44 
50  typedef LightSmartPtr<QualityEstimator>::tPtr Ptr;
51 
64  struct Quality
65  {
71  int total;
72 
78  int lighting;
79 
85  int noise;
86 
92  int sharpness;
93 
99  int flare;
100  };
101 
102 
125 
126 private:
127 
129  const DHPtr &dll_handle,
130  void* impl);
131 
132  friend class FacerecService;
133  friend class object_with_ref_counter<QualityEstimator>;
134 };
135 
136 } // pbio namespace
137 
138 
139 
143 
144 namespace pbio
145 {
146 
147 
148 inline
149 QualityEstimator::QualityEstimator(
150  const DHPtr &dll_handle,
151  void* impl):
152 ComplexObject(dll_handle, impl)
153 {
154  // nothing else
155 }
156 
157 
158 inline
160 {
161  void* exception = NULL;
162 
163  Quality result;
164 
165  _dll_handle->QualityEstimator_estimateQuality(
166  _impl,
167  (pbio::facerec::RawSampleImpl const*) sample._impl,
168  &result.lighting,
169  &result.noise,
170  &result.sharpness,
171  &result.flare,
172  &exception);
173 
174  // total is the worst quality, i.e. the max value
175 
176  result.total = 1;
177  result.total = std::max<int>(result.total, result.lighting);
178  result.total = std::max<int>(result.total, result.noise);
179  result.total = std::max<int>(result.total, result.sharpness);
180  result.total = std::max<int>(result.total, result.flare);
181 
182  checkException(exception, *_dll_handle);
183 
184  return result;
185 }
186 
187 
188 } // pbio namespace
189 
190 #endif // __PBIO_API__PBIO__QUALITY_ESTIMATOR_H_
Interface object for creating other interface objects.
Definition: FacerecService.h:64
Interface object that stores a captured face sample.
Definition: RawSample.h:49
int lighting
Lighting uniformity.
Definition: QualityEstimator.h:78
Set of quality parameters. Each parameter is in range 1 to 5. '1' stands for 'best qualit'...
Definition: QualityEstimator.h:64
Quality estimateQuality(const pbio::RawSample &) const
Estimates quality of a given face sample.
Definition: QualityEstimator.h:159
int sharpness
Sharpness.
Definition: QualityEstimator.h:92
LightSmartPtr< QualityEstimator >::tPtr Ptr
Alias for the type of a smart pointer to QualityEstimator.
Definition: QualityEstimator.h:50
Error - the class of exceptions thrown when errors occur.
int total
Total quality score.
Definition: QualityEstimator.h:71
Interface object used to estimate sample quality.
Definition: QualityEstimator.h:41
int flare
Flare.
Definition: QualityEstimator.h:99
int noise
Noise.
Definition: QualityEstimator.h:85
SmartPtr.
Definition: FacerecService.mm:79