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

IHeadPoseEstimator.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 <cmath>
9
10 namespace fsdk {
11
12 #ifndef DOXYGEN_SHOULD_SKIP_THIS
13 DECLARE_SMARTPTR(IHeadPoseEstimator);
14 #endif
15
26 struct HeadPoseEstimation {
27 float pitch;
28 float yaw;
29 float roll;
30
31 enum FrontalFaceType {
32 Non = 0,
33 Good,
34 ISO
35 };
36
40 inline FrontalFaceType getFrontalFaceType() const;
41 };
42
53 struct IHeadPoseEstimator : IRefCounted {
63 virtual Result<FSDKError>
64 estimate(const Image& image, const Detection& detection, HeadPoseEstimation& out) const noexcept = 0;
65
77 virtual Result<FSDKError> estimate(
78 Span<const Image> images,
79 Span<const Detection> detections,
80 Span<HeadPoseEstimation> out) const noexcept = 0;
81
93 virtual Result<FSDKError> validate(
94 Span<const Image> images,
95 Span<const Detection> detections,
96 Span<Result<FSDKError>> errors) const noexcept = 0;
97 };
98
99 /*
100 Implementation details.
101 */
102 HeadPoseEstimation::FrontalFaceType HeadPoseEstimation::getFrontalFaceType() const {
103 if(std::abs(roll) <= 8 && std::abs(pitch) <= 5 && std::abs(yaw) <= 5)
104 return HeadPoseEstimation::ISO;
105 if(std::abs(roll) <= 30 && std::abs(pitch) <= 40 && std::abs(yaw) <= 40)
106 return HeadPoseEstimation::Good;
107 return HeadPoseEstimation::Non;
108 }
109
111 } // namespace fsdk
fsdk::HeadPoseEstimation
Head pose estimation output.
Definition: IHeadPoseEstimator.h:26
DECLARE_SMARTPTR
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:70
fsdk
SDK namespace.
Definition: IAGSEstimator.h:8
fsdk::Result
A structure that encapsulates an action result enumeration.
Definition: Result.h:27
Types.h
Common data types and structures.
fsdk::HeadPoseEstimation::roll
float roll
Roll angle estimation.
Definition: IHeadPoseEstimator.h:29
fsdk::HeadPoseEstimation::yaw
float yaw
Yaw angle estimation.
Definition: IHeadPoseEstimator.h:28
fsdk::IHeadPoseEstimator::validate
virtual Result< FSDKError > validate(Span< const Image > images, Span< const Detection > detections, Span< Result< FSDKError >> errors) const noexcept=0
Validate input of multiple frames in a single function call.
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::HeadPoseEstimation::Non
Non-frontal face.
Definition: IHeadPoseEstimator.h:32
fsdk::HeadPoseEstimation::Good
Good for recognition; Doesn&#39;t descrease recall and looks fine.
Definition: IHeadPoseEstimator.h:33
fsdk::Image
Image.
Definition: Image.h:38
fsdk::HeadPoseEstimation::ISO
GOST/ISO angles.
Definition: IHeadPoseEstimator.h:34
fsdk::HeadPoseEstimation::FrontalFaceType
FrontalFaceType
Definition: IHeadPoseEstimator.h:31
fsdk::HeadPoseEstimation::pitch
float pitch
Pitch angle estimation.
Definition: IHeadPoseEstimator.h:27
fsdk::IHeadPoseEstimator
Head pose angles estimator interface.
Definition: IHeadPoseEstimator.h:53
fsdk::Detection
Detection structure. Stores a detected bounding box within a source image rect.
Definition: Detection.h:10
fsdk::Span
Span. Not owning data view. It incapsulated pointer to the continuous array with one or more T objec...
Definition: Span.h:14
fsdk::HeadPoseEstimation::getFrontalFaceType
FrontalFaceType getFrontalFaceType() const
Returns type of face frontality.
Definition: IHeadPoseEstimator.h:102
fsdk::IHeadPoseEstimator::estimate
virtual Result< FSDKError > estimate(const Image &image, const Detection &detection, HeadPoseEstimation &out) const noexcept=0
Estimate the angles.