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

IPPEEstimator.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 #include <algorithm>
9
10 namespace fsdk {
11
12 #ifndef DOXYGEN_SHOULD_SKIP_THIS
13 DECLARE_SMARTPTR(IPPEEstimator);
14 #endif
15
29 struct OnePPEEstimation {
30 float positive = 0.0f;
31 float negative = 0.0f;
32 float unknown = 0.0f;
33
34 enum class PPEState : uint8_t {
35 Positive,
36 Negative,
37 Unknown,
38 Count
39 };
40
44 inline PPEState getPredominantState();
45 };
46
47 using PPEState = OnePPEEstimation::PPEState;
48
58 struct PPEEstimation {
59 OnePPEEstimation helmetEstimation;
60 OnePPEEstimation hoodEstimation;
61 OnePPEEstimation vestEstimation;
62 OnePPEEstimation glovesEstimation;
63 OnePPEEstimation safeharnessEstimation;
64 };
65
70 struct IPPEEstimator : IRefCounted {
79 virtual ResultValue<FSDKError, PPEEstimation>
80 estimate(const Image& image, const Detection& detection) const noexcept = 0;
81 };
82
83 PPEState OnePPEEstimation::getPredominantState() {
84 float* arr = &this->positive;
85 return static_cast<PPEState>(
86 std::distance(arr, std::max_element(arr, arr + static_cast<int>(PPEState::Count))));
87 }
88
90 } // 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::OnePPEEstimation
Personal Protection Equipment estimation structure (a.k.a. PPE) This structure contains prediction sc...
Definition: IPPEEstimator.h:29
fsdk::IPPEEstimator
Personal Protection Equipment estimator interface.
Definition: IPPEEstimator.h:70
Types.h
Common data types and structures.
fsdk::IPPEEstimator::estimate
virtual ResultValue< FSDKError, PPEEstimation > estimate(const Image &image, const Detection &detection) const noexcept=0
estimate PPE.
fsdk::OnePPEEstimation::getPredominantState
PPEState getPredominantState()
returns predominant personal equipment state
Definition: IPPEEstimator.h:83
IObject.h
Object system types and interfaces.
fsdk::OnePPEEstimation::PPEState::Positive
person is wearing specific personal equipment;
FSDKError.h
Common SDK error codes.
fsdk::IRefCounted
Base strong reference counted object interface.
Definition: IRefCounted.h:37
fsdk::OnePPEEstimation::PPEState
PPEState
Definition: IPPEEstimator.h:34
fsdk::ResultValue
Addon for Result to output some value aside the result. Specialization for copiable types...
Definition: ResultValue.h:21
fsdk::OnePPEEstimation::PPEState::Negative
person isn&#39;t wearing specific personal equipment;
fsdk::Image
Image.
Definition: Image.h:38
fsdk::OnePPEEstimation::PPEState::Unknown
it&#39;s hard to tell wether person wears specific personal equipment.
fsdk::OnePPEEstimation::PPEState::Count
state count
fsdk::Detection
Detection structure. Stores a detected bounding box within a source image rect.
Definition: Detection.h:10
fsdk::PPEEstimation
Personal Protection Equipment output structure. This structure aggregates multiple PPE attributes pre...
Definition: IPPEEstimator.h:58