Face Engine SDK  5.8.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 
22  struct Quality {
23  float light;
24  float dark;
25  float gray;
26  float blur;
30  inline float getQuality() const noexcept;
31  };
32 
48  float blur;
49  float light;
50  float darkness;
51  float illumination;
52  float specularity;
53  bool isBlurred;
54  bool isHighlighted;
55  bool isDark;
56  bool isIlluminated;
57  bool isNotSpecular;
61  inline bool isGood() const noexcept;
62  };
63 
86  virtual Result<FSDKError>
87  estimate(const Image& warp, Quality& quality) const noexcept = 0;
88 
99  virtual Result<FSDKError>
100  estimate(
101  Span<const Image> warps,
102  Span<Quality> quality) const noexcept = 0;
103 
112  virtual Result<FSDKError> estimate(
113  const Image& warp,
114  SubjectiveQuality& quality) const noexcept = 0;
115 
126  virtual Result<FSDKError>
127  estimate(
128  Span<const Image> warps,
129  Span<SubjectiveQuality> quality) const noexcept = 0;
130 
141  virtual Result<FSDKError>
142  validate(
143  Span<const Image> warps,
144  Span<Result<FSDKError>> errors) const noexcept = 0;
145  };
146 
147  /*
148  Implementation details.
149  */
150  float Quality::getQuality() const noexcept {
151  float min1 = std::min(dark, light);
152  float min2 = std::min(gray, blur);
153  return std::min(min1, min2);
154  }
155 
156  /*
157  Implementation details.
158  */
159  bool SubjectiveQuality::isGood() const noexcept {
160  if (!isBlurred && !isHighlighted && !isDark && !isIlluminated && !isNotSpecular)
161  return true;
162  return false;
163  }
164 
165 } // 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:22
Subjective Quality estimation structure Each estimation is given in normalized [0, 1] range. Parameter meanings:
Definition: IQualityEstimator.h:47
Object system types and interfaces.
Common SDK error codes.
bool isGood() const noexcept
Definition: IQualityEstimator.h:159
Base strong reference counted object interface.
Definition: IRefCounted.h:36
float getQuality() const noexcept
Definition: IQualityEstimator.h:150
virtual Result< FSDKError > estimate(const Image &warp, Quality &quality) const noexcept=0
Estimate the quality.
Image.
Definition: Image.h:38
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:77