Face Engine SDK  5.25.0
A face detection, recognition and tracking engine.
include/fsdk/Estimators/IQualityEstimator.h
00001 #pragma once
00002 
00003 #include <fsdk/IObject.h>
00004 #include <fsdk/FSDKError.h>
00005 #include <fsdk/Optional.h>
00006 #include <fsdk/Types.h>
00007 
00008 namespace fsdk {
00009 
00010 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00011     DECLARE_SMARTPTR(IQualityEstimator);
00012 #endif
00013 
00027     struct Quality {
00028         float light;
00029         float dark;
00030         float gray;
00031         float blur;
00035         inline float getQuality() const noexcept;
00036     };
00037 
00052     struct SubjectiveQuality {
00053         float blur;
00054         float light;
00055         float darkness;
00056         float illumination;
00057         float specularity;
00058         bool isBlurred;
00059         bool isHighlighted;
00060         bool isDark;
00061         bool isIlluminated;
00062         bool isNotSpecular;
00066         inline bool isGood() const noexcept;
00067     };
00068 
00083     struct IQualityEstimator : IRefCounted {
00093         virtual Result<FSDKError> estimate(const Image& warp, Quality& quality) const noexcept = 0;
00094 
00105         virtual Result<FSDKError> estimate(Span<const Image> warps, Span<Quality> quality) const noexcept = 0;
00106 
00115         virtual Result<FSDKError> estimate(const Image& warp, SubjectiveQuality& quality) const noexcept = 0;
00116 
00127         virtual Result<FSDKError>
00128         estimate(Span<const Image> warps, Span<SubjectiveQuality> quality) const noexcept = 0;
00129 
00140         virtual Result<FSDKError>
00141         validate(Span<const Image> warps, Span<Result<FSDKError>> errors) const noexcept = 0;
00142     };
00143 
00144     /*
00145         Implementation details.
00146     */
00147     float Quality::getQuality() const noexcept {
00148         float min1 = std::min(dark, light);
00149         float min2 = std::min(gray, blur);
00150         return std::min(min1, min2);
00151     }
00152 
00153     /*
00154         Implementation details.
00155     */
00156     bool SubjectiveQuality::isGood() const noexcept {
00157         if(!isBlurred && !isHighlighted && !isDark && !isIlluminated && !isNotSpecular)
00158             return true;
00159         return false;
00160     }
00161 
00163 } // namespace fsdk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines