Face Engine SDK  4.9.0
A face detection, recognition and tracking engine.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
IHeadWearEstimator.h
1 #pragma once
2 
3 #include <fsdk/IObject.h>
4 #include <fsdk/FSDKError.h>
5 
6 #include <fsdk/Types/Image.h>
7 #include <fsdk/Types/Result.h>
8 #include <fsdk/Types/Span.h>
9 
10 namespace fsdk {
11 
12 #ifndef DOXYGEN_SHOULD_SKIP_THIS
13  DECLARE_SMARTPTR(IHeadWearEstimator);
14 #endif
15 
20  enum class HeadWearState {
21  Yes = 0, //< there is headwear
22  No, //< there is no headwear
23  Count
24  };
25 
34  float scores[static_cast<int>(HeadWearState::Count)];
35 
41  inline float getScore(HeadWearState state) const;
42  };
43 
48  enum class HeadWearType : uint8_t {
49  NoHeadWear = 0, //< there is no headwear on the head
50  BaseballCap, //< there is baseball cap on the head
51  Beanie, //< there is beanie on the head
52  PeakedCap, //< there is peaked cap on the head
53  Shawl, //< there is shawl on the head
54  HatWithEarFlaps, //< there is hat with ear flaps on the head
55  Helmet, //< there is helmet on the head
56  Hood, //< there is hood on the head
57  Hat, //< there is hat on the head
58  Other, //< something other is on the head
59  Count
60  };
61 
70  float scores[static_cast<int>(HeadWearType::Count)];
71 
77  inline float getScore(HeadWearType type) const;
78  };
79 
89  };
91 
105  virtual Result<FSDKError> estimate(
106  const Image& warp,
107  HeadWearEstimation& estimation) const noexcept = 0;
108 
119  virtual Result<FSDKError> estimate(
120  Span<const Image> warps,
121  Span<HeadWearEstimation> estimations) const noexcept = 0;
122  };
123 
124  /*
125  Implementation details.
126  */
128  switch (state) {
129  case HeadWearState::Yes:
130  case HeadWearState::No:
131  return scores[static_cast<int>(state)];
132  default:
133  return -1.0f;
134  }
135  }
136 
137  /*
138  Implementation details.
139  */
141  switch (type) {
142  case HeadWearType::NoHeadWear:
143  case HeadWearType::BaseballCap:
144  case HeadWearType::Beanie:
145  case HeadWearType::PeakedCap:
146  case HeadWearType::Shawl:
147  case HeadWearType::HatWithEarFlaps:
148  case HeadWearType::Helmet:
149  case HeadWearType::Hood:
150  case HeadWearType::Hat:
151  case HeadWearType::Other:
152  return scores[static_cast<int>(type)];
153  default:
154  return -1.0f;
155  }
156  }
157 
158 } // namespace fsdk
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:59
float scores[static_cast< int >(HeadWearType::Count)]
estimation scores
Definition: IHeadWearEstimator.h:70
HeadWearType estimator output structure. This structure contains the result of estimation (...
Definition: IHeadWearEstimator.h:68
HeadWearState
HeadWearState estimator output enum. This enum contains all possible estimation results.
Definition: IHeadWearEstimator.h:20
HeadWear estimator interface.
Definition: IHeadWearEstimator.h:96
Object system types and interfaces.
HeadWearState result
estimation result (
Definition: IHeadWearEstimator.h:33
Common SDK error codes.
Base strong reference counted object interface.
Definition: IRefCounted.h:36
virtual Result< FSDKError > estimate(const Image &warp, HeadWearEstimation &estimation) const noexcept=0
Estimate Head Wear probabilities.
float getScore(HeadWearState state) const
Returns score of required headwear state.
Definition: IHeadWearEstimator.h:127
float scores[static_cast< int >(HeadWearState::Count)]
estimation scores
Definition: IHeadWearEstimator.h:34
float getScore(HeadWearType type) const
Returns score of required headwear type.
Definition: IHeadWearEstimator.h:140
Image.
Definition: Image.h:38
HeadWearStateEstimation state
Definition: IHeadWearEstimator.h:86
HeadWearTypeEstimation type
Definition: IHeadWearEstimator.h:88
HeadWearType
HeadWearType estimator output enum. This enum contains all possible estimation results.
Definition: IHeadWearEstimator.h:48
HeadWear estimator output structure. This structure contains the result of HeadWearState and HeadWear...
Definition: IHeadWearEstimator.h:85
Span. Not owning data view. It incapsulated pointer to the continuous array with one or more T objec...
Definition: Span.h:13
HeadWearState estimator output structure. This structure contains the result of estimation (...
Definition: IHeadWearEstimator.h:32
HeadWearType result
estimation result (
Definition: IHeadWearEstimator.h:69