Face Engine SDK  5.25.0
A face detection, recognition and tracking engine.
include/fsdk/Estimators/IHeadPoseEstimator.h
00001 #pragma once
00002 
00003 #include <fsdk/IObject.h>
00004 #include <fsdk/FSDKError.h>
00005 #include <fsdk/Optional.h>
00006 #include <fsdk/Types.h>
00007 
00008 #include <cmath>
00009 
00010 namespace fsdk {
00011 
00012 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00013     DECLARE_SMARTPTR(IHeadPoseEstimator);
00014 #endif
00015 
00026     struct HeadPoseEstimation {
00027         float pitch; 
00028         float yaw;   
00029         float roll;  
00030 
00031         enum FrontalFaceType {
00032             Non = 0, 
00033             Good,    
00034             ISO      
00035         };
00036 
00040         inline FrontalFaceType getFrontalFaceType() const;
00041     };
00042 
00053     struct IHeadPoseEstimator : IRefCounted {
00063         virtual Result<FSDKError>
00064         estimate(const Image& image, const Detection& detection, HeadPoseEstimation& out) const noexcept = 0;
00065 
00077         virtual Result<FSDKError> estimate(
00078             Span<const Image> images,
00079             Span<const Detection> detections,
00080             Span<HeadPoseEstimation> out) const noexcept = 0;
00081 
00093         virtual Result<FSDKError> validate(
00094             Span<const Image> images,
00095             Span<const Detection> detections,
00096             Span<Result<FSDKError>> errors) const noexcept = 0;
00097     };
00098 
00099     /*
00100         Implementation details.
00101     */
00102     HeadPoseEstimation::FrontalFaceType HeadPoseEstimation::getFrontalFaceType() const {
00103         if(std::abs(roll) <= 8 && std::abs(pitch) <= 5 && std::abs(yaw) <= 5)
00104             return HeadPoseEstimation::ISO;
00105         if(std::abs(roll) <= 30 && std::abs(pitch) <= 40 && std::abs(yaw) <= 40)
00106             return HeadPoseEstimation::Good;
00107         return HeadPoseEstimation::Non;
00108     }
00109 
00111 } // namespace fsdk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines