3DiVi Face SDK  3.21.0
 Указатель Классы Пространства имен Файлы Функции Переменные Определения типов Перечисления Элементы перечислений Свойства Группы
QualityEstimator.h
См. документацию.
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_
Интерфейсный объект для создания других интерфейсных объектов.
Definition: FacerecService.h:64
Интерфейсный объект, хранящий образец лица.
Definition: RawSample.h:49
int lighting
Равномерность освещения.
Definition: QualityEstimator.h:78
Набор характеристик качества. Каждая характеристика находится в диапазоне от 1 до 5...
Definition: QualityEstimator.h:64
Quality estimateQuality(const pbio::RawSample &) const
Определить качество поданного образца лица.
Definition: QualityEstimator.h:159
int sharpness
Резкость.
Definition: QualityEstimator.h:92
LightSmartPtr< QualityEstimator >::tPtr Ptr
Псевдоним для типа умного указателя на QualityEstimator.
Definition: QualityEstimator.h:50
Error - класс исключений, выбрасываемых при возникновении ошибок.
RawSample - Интерфейсный объект, хранящий образец лица.
int total
Показатель общего качества.
Definition: QualityEstimator.h:71
Интерфейсный объект для определения качества образца лица.
Definition: QualityEstimator.h:41
int flare
Засветка.
Definition: QualityEstimator.h:99
int noise
Зашумленность.
Definition: QualityEstimator.h:85
SmartPtr.