| Face Engine SDK 5.31.2 A face detection, recognition and tracking engine.

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
52 struct SubjectiveQuality {
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
83 struct IQualityEstimator : IRefCounted {
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
DECLARE_SMARTPTR
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:56
fsdk
SDK namespace.
Definition: IAGSEstimator.h:8
fsdk::Result
A structure that encapsulates an action result enumeration.
Definition: Result.h:27
Types.h
Common data types and structures.
fsdk::Quality
Quality estimation structure Each estimation is given in normalized [0, 1] range. Parameter meanings:...
Definition: IQualityEstimator.h:27
fsdk::SubjectiveQuality
Subjective Quality estimation structure Each estimation is given in normalized [0, 1] range. Parameter meanings:
Definition: IQualityEstimator.h:52
IObject.h
Object system types and interfaces.
FSDKError.h
Common SDK error codes.
fsdk::IRefCounted
Base strong reference counted object interface.
Definition: IRefCounted.h:37
fsdk::Quality::getQuality
float getQuality() const noexcept
Definition: IQualityEstimator.h:147
fsdk::IQualityEstimator::estimate
virtual Result< FSDKError > estimate(const Image &warp, Quality &quality) const noexcept=0
Estimate the quality.
fsdk::Image
Image.
Definition: Image.h:38
fsdk::SubjectiveQuality::isGood
bool isGood() const noexcept
Definition: IQualityEstimator.h:156
fsdk::IQualityEstimator::validate
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.
fsdk::Span
Span. Not owning data view. It incapsulated pointer to the continuous array with one or more T objec...
Definition: Span.h:14
fsdk::IQualityEstimator
Image quality estimator interface.
Definition: IQualityEstimator.h:83