| Face Engine SDK 5.12.0 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
22 struct Quality {
23 float light;
24 float dark;
25 float gray;
26 float blur;
30 inline float getQuality() const noexcept;
31 };
32
47 struct SubjectiveQuality {
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
77 struct IQualityEstimator : IRefCounted {
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
DECLARE_SMARTPTR
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:59
fsdk
SDK namespace.
Definition: IAGSEstimator.h:8
fsdk::Result
A structure that encapsulates an action result enumeration.
Definition: Result.h:29
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:22
fsdk::SubjectiveQuality
Subjective Quality estimation structure Each estimation is given in normalized [0, 1] range. Parameter meanings:
Definition: IQualityEstimator.h:47
IObject.h
Object system types and interfaces.
FSDKError.h
Common SDK error codes.
fsdk::SubjectiveQuality::isGood
bool isGood() const noexcept
Definition: IQualityEstimator.h:159
fsdk::IRefCounted
Base strong reference counted object interface.
Definition: IRefCounted.h:36
fsdk::Quality::getQuality
float getQuality() const noexcept
Definition: IQualityEstimator.h:150
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::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:77