Face Engine SDK  5.21.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 
93  virtual Result<FSDKError> estimate(const Image& warp, Quality& quality) const noexcept = 0;
94 
105  virtual Result<FSDKError> estimate(Span<const Image> warps, Span<Quality> quality) const noexcept = 0;
106 
115  virtual Result<FSDKError> estimate(const Image& warp, SubjectiveQuality& quality) const noexcept = 0;
116 
127  virtual Result<FSDKError>
128  estimate(Span<const Image> warps, Span<SubjectiveQuality> quality) const noexcept = 0;
129 
140  virtual Result<FSDKError>
141  validate(Span<const Image> warps, Span<Result<FSDKError>> errors) const noexcept = 0;
142  };
143 
144  /*
145  Implementation details.
146  */
147  float Quality::getQuality() const noexcept {
148  float min1 = std::min(dark, light);
149  float min2 = std::min(gray, blur);
150  return std::min(min1, min2);
151  }
152 
153  /*
154  Implementation details.
155  */
156  bool SubjectiveQuality::isGood() const noexcept {
157  if(!isBlurred && !isHighlighted && !isDark && !isIlluminated && !isNotSpecular)
158  return true;
159  return false;
160  }
161 
163 } // namespace fsdk
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:56
A structure that encapsulates an action result enumeration.
Definition: Result.h:27
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:37
float getQuality() const noexcept
Definition: IQualityEstimator.h:147
virtual Result< FSDKError > estimate(const Image &warp, Quality &quality) const noexcept=0
Estimate the quality.
Image.
Definition: Image.h:38
bool isGood() const noexcept
Definition: IQualityEstimator.h:156
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:83