Face Engine SDK  5.14.0
A face detection, recognition and tracking engine.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
IQualityEstimator.h
1 #pragma once
2 
3 #include <fsdk/IObject.h>
4 #include <fsdk/FSDKError.h>
5 #include <fsdk/Optional.h>
6 #include <fsdk/Types.h>
7 
8 namespace fsdk {
9 
10 #ifndef DOXYGEN_SHOULD_SKIP_THIS
11  DECLARE_SMARTPTR(IQualityEstimator);
12 #endif
13 
27  struct Quality {
28  float light;
29  float dark;
30  float gray;
31  float blur;
35  inline float getQuality() const noexcept;
36  };
37 
53  float blur;
54  float light;
55  float darkness;
56  float illumination;
57  float specularity;
58  bool isBlurred;
59  bool isHighlighted;
60  bool isDark;
61  bool isIlluminated;
62  bool isNotSpecular;
66  inline bool isGood() const noexcept;
67  };
68 
91  virtual Result<FSDKError>
92  estimate(const Image& warp, Quality& quality) const noexcept = 0;
93 
104  virtual Result<FSDKError>
105  estimate(
106  Span<const Image> warps,
107  Span<Quality> quality) const noexcept = 0;
108 
117  virtual Result<FSDKError> estimate(
118  const Image& warp,
119  SubjectiveQuality& quality) const noexcept = 0;
120 
131  virtual Result<FSDKError>
132  estimate(
133  Span<const Image> warps,
134  Span<SubjectiveQuality> quality) const noexcept = 0;
135 
146  virtual Result<FSDKError>
147  validate(
148  Span<const Image> warps,
149  Span<Result<FSDKError>> errors) const noexcept = 0;
150  };
151 
152  /*
153  Implementation details.
154  */
155  float Quality::getQuality() const noexcept {
156  float min1 = std::min(dark, light);
157  float min2 = std::min(gray, blur);
158  return std::min(min1, min2);
159  }
160 
161  /*
162  Implementation details.
163  */
164  bool SubjectiveQuality::isGood() const noexcept {
165  if (!isBlurred && !isHighlighted && !isDark && !isIlluminated && !isNotSpecular)
166  return true;
167  return false;
168  }
170 } // namespace fsdk
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:59
A structure that encapsulates an action result enumeration.
Definition: Result.h:29
Common data types and structures.
Quality estimation structure Each estimation is given in normalized [0, 1] range. Parameter meanings:...
Definition: IQualityEstimator.h:27
Subjective Quality estimation structure Each estimation is given in normalized [0, 1] range. Parameter meanings:
Definition: IQualityEstimator.h:52
Object system types and interfaces.
Common SDK error codes.
Base strong reference counted object interface.
Definition: IRefCounted.h:36
float getQuality() const noexcept
Definition: IQualityEstimator.h:155
virtual Result< FSDKError > estimate(const Image &warp, Quality &quality) const noexcept=0
Estimate the quality.
Image.
Definition: Image.h:39
bool isGood() const noexcept
Definition: IQualityEstimator.h:164
virtual Result< FSDKError > validate(Span< const Image > warps, Span< Result< FSDKError >> errors) const noexcept=0
Validate input of multiple frames in a single function call.
Span. Not owning data view. It incapsulated pointer to the continuous array with one or more T objec...
Definition: Span.h:14
Image quality estimator interface.
Definition: IQualityEstimator.h:82