| Face Engine SDK 5.12.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
13 struct IEthnicityEstimator : IRefCounted {
14 enum class Ethnicities {
15 Black = 0,
16 Indian,
17 Asian,
18 White,
19 Arab,
20 Pamir,
21 Kavkaz,
22 Other
23 };
24
25 struct EstimationResult {
26 inline float getEthnicityScore(Ethnicities ethnicity) const;
27
29 Ethnicities predominant;
32 float scores[static_cast<int>(Ethnicities::Other)];
33 };
34
35 virtual Result<FSDKError> estimate(
36 const Image& warp,
37 EstimationResult& estimation) const noexcept = 0;
38
39 virtual Result<FSDKError> estimate(
40 Span<const Image> warps,
41 Span<EstimationResult> estimations) const noexcept = 0;
42 };
43
44
45 float
46 IEthnicityEstimator::EstimationResult::getEthnicityScore(IEthnicityEstimator::Ethnicities ethnicity ) const {
47 if (static_cast<uint32_t>(ethnicity) >= static_cast<uint32_t>(IEthnicityEstimator::Ethnicities::Other)) {
48 return 0;
49 }
50 return scores[static_cast<uint32_t>(ethnicity)];
51 }
52
53 } // 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::IEthnicityEstimator
Definition: IEthnicityEstimator.h:13
fsdk::Result
A structure that encapsulates an action result enumeration.
Definition: Result.h:29
Types.h
Common data types and structures.
fsdk::IEthnicityEstimator::EstimationResult::getEthnicityScore
float getEthnicityScore(Ethnicities ethnicity) const
the result ethnicity
Definition: IEthnicityEstimator.h:46
fsdk::IEthnicityEstimator::EstimationResult::predominant
Ethnicities predominant
Definition: IEthnicityEstimator.h:29
IObject.h
Object system types and interfaces.
FSDKError.h
Common SDK error codes.
fsdk::IRefCounted
Base strong reference counted object interface.
Definition: IRefCounted.h:36
fsdk::Image
Image.
Definition: Image.h:38
fsdk::IEthnicityEstimator::EstimationResult
Definition: IEthnicityEstimator.h:25
fsdk::Span
Span. Not owning data view. It incapsulated pointer to the continuous array with one or more T objec...
Definition: Span.h:14