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

IEthnicityEstimator.h
1 #pragma once
2
3 #include <fsdk/FSDKError.h>
4 #include <fsdk/IObject.h>
5 #include <fsdk/Types.h>
6
7 namespace fsdk {
8
9 #ifndef DOXYGEN_SHOULD_SKIP_THIS
10 DECLARE_SMARTPTR(IEthnicityEstimator);
11 #endif
12
18 struct IEthnicityEstimator : IRefCounted {
19 enum class Ethnicities {
20 Black = 0,
21 Indian,
22 Asian,
23 White,
24 Arab,
25 Pamir,
26 Kavkaz,
27 Other
28 };
29
30 struct EstimationResult {
31 inline float getEthnicityScore(Ethnicities ethnicity) const;
32
34 Ethnicities predominant;
37 float scores[static_cast<int>(Ethnicities::Other)];
38 };
39
40 virtual Result<FSDKError> estimate(const Image& warp, EstimationResult& estimation) const noexcept = 0;
41
42 virtual Result<FSDKError>
43 estimate(Span<const Image> warps, Span<EstimationResult> estimations) const noexcept = 0;
44 };
45
46 float
47 IEthnicityEstimator::EstimationResult::getEthnicityScore(IEthnicityEstimator::Ethnicities ethnicity) const {
48 if(static_cast<uint32_t>(ethnicity) >= static_cast<uint32_t>(IEthnicityEstimator::Ethnicities::Other)) {
49 return 0;
50 }
51 return scores[static_cast<uint32_t>(ethnicity)];
52 }
53
55 } // 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::IEthnicityEstimator
Definition: IEthnicityEstimator.h:18
fsdk::Result
A structure that encapsulates an action result enumeration.
Definition: Result.h:27
Types.h
Common data types and structures.
fsdk::IEthnicityEstimator::EstimationResult::predominant
Ethnicities predominant
Definition: IEthnicityEstimator.h:34
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::IEthnicityEstimator::EstimationResult::getEthnicityScore
float getEthnicityScore(Ethnicities ethnicity) const
the result ethnicity
Definition: IEthnicityEstimator.h:47
fsdk::Image
Image.
Definition: Image.h:38
fsdk::IEthnicityEstimator::EstimationResult
Definition: IEthnicityEstimator.h:30
fsdk::Span
Span. Not owning data view. It incapsulated pointer to the continuous array with one or more T objec...
Definition: Span.h:14