![]() |
Face Engine SDK
5.26.0
A face detection, recognition and tracking engine.
|
00001 #pragma once 00002 00003 #include <fsdk/FSDKError.h> 00004 #include <fsdk/IObject.h> 00005 #include <fsdk/Types.h> 00006 00007 namespace fsdk { 00008 00009 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00010 DECLARE_SMARTPTR(IEthnicityEstimator); 00011 #endif 00012 00018 struct IEthnicityEstimator : IRefCounted { 00019 enum class Ethnicities { 00020 Black = 0, 00021 Indian, 00022 Asian, 00023 White, 00024 Arab, 00025 Pamir, 00026 Kavkaz, 00027 Other 00028 }; 00029 00030 struct EstimationResult { 00031 inline float getEthnicityScore(Ethnicities ethnicity) const; 00032 00034 Ethnicities predominant; 00037 float scores[static_cast<int>(Ethnicities::Other)]; 00038 }; 00039 00040 virtual Result<FSDKError> estimate(const Image& warp, EstimationResult& estimation) const noexcept = 0; 00041 00042 virtual Result<FSDKError> 00043 estimate(Span<const Image> warps, Span<EstimationResult> estimations) const noexcept = 0; 00044 }; 00045 00046 float 00047 IEthnicityEstimator::EstimationResult::getEthnicityScore(IEthnicityEstimator::Ethnicities ethnicity) const { 00048 if(static_cast<uint32_t>(ethnicity) >= static_cast<uint32_t>(IEthnicityEstimator::Ethnicities::Other)) { 00049 return 0; 00050 } 00051 return scores[static_cast<uint32_t>(ethnicity)]; 00052 } 00053 00055 } // namespace fsdk