#pragma once #include "IHeadPoseEstimator.h" // for HeadPoseEstimation #include #include #include #include #include #include namespace fsdk { #ifndef DOXYGEN_SHOULD_SKIP_THIS DECLARE_SMARTPTR(IBestShotQualityEstimator); #endif /** * @brief BestShotQuality estimator interface. * @note This estimator is designed to work with Image and detection; * */ struct IBestShotQualityEstimator : IRefCounted { /** * @brief EstimationRequest lists all possible estimation attributes * that BestShotQuality estimator is able to estimate. * */ enum EstimationRequest { estimateAGS = 1 << 0, //!< Estimate AGS estimateHeadPose = 1 << 1, //!< Estimate HeadPose estimateAll = 0xffff //!< Make full estimation (all attributes) }; /** * @brief BestShotQualityEstimator output structure * */ struct EstimationResult { Optional headPose; //!< HeadPose estimation if was requested, empty otherwise Optional ags; //!< AGS estimation if was requested, empty otherwise }; /** * @brief Estimate unified AGS and HeadPose attributes. * @param [in] image source image; * @param [in] detection detection coordinates in image space; * @param [in] request EstimationRequest structure; * @param [out] result output estimation. * @return Result with error code. * @see IBestShotQualityEstimator::EstimationRequest, IBestShotQualityEstimator::EstimationResult, * Detection, Image, Result and FSDKError for details. * @note image format must be R8G8B8, @see Format. * */ virtual Result estimate( const Image& image, const Detection& detection, const EstimationRequest request, EstimationResult& result) const noexcept = 0; /** * @brief Estimate unified AGS and HeadPose attributes of multiple frames in a single estimate function call. * @param [in] images span of source images. * @param [in] detections span of detection coordinates in corresponding source images space. * @param [in] request EstimationRequest structure. * @param [out] results span of estimations. * @return Result with error code. * @see IBestShotQualityEstimator::EstimationRequest, IBestShotQualityEstimator::EstimationResult, * Span, Detection, Image, Result and FSDKError for details. * @note images format must be R8G8B8, @see Format. * @note all spans should be based on user owned continuous collections. * @note all spans should be equal size. * */ virtual Result estimate( Span images, Span detections, const EstimationRequest request, Span results) const noexcept = 0; /** * @brief Common aliases for BestShotQuality asynchronous interface. * */ using EstimationBatch = std::vector; using EstimationBatchFuture = vlc::future; /** * @brief Asynchronously estimate unified AGS and HeadPose attributes of multiple frames in a single estimate function call. * @param [in] images span of source images. * @param [in] detections span of detection coordinates in corresponding source images space. * @param [in] request EstimationRequest structure. * @return Future estimation result object. * @see IBestShotQualityEstimator::EstimationRequest, IBestShotQualityEstimator::EstimationResult, * Span, Detection, Image, Result, FSDKError and vlc::future for details. * @note images format must be R8G8B8, @see Format. * @note all spans should be based on user owned continuous collections. * @note all spans should be equal size. * @note this method is experimental and interface may be changed in the future. * @note this method is not marked as noexcept and may throw an exception. * */ virtual EstimationBatchFuture estimateAsync( Span images, Span detections, const EstimationRequest request) const = 0; /** * @brief Validate input of multiple frames in a single function call. * @param [in] images span of source images. * @param [in] detections span of detection coordinates in corresponding source images space. * @param [in] request EstimationRequest structure. * @param [out] errors output span of errors for each image. * @return Result with error code. * @see IBestShotQualityEstimator::EstimationRequest, * Span, Detection, Image, Result and FSDKError for details. * @note images format must be R8G8B8, @see Format. * @note all spans should be based on user owned continuous collections. * @note all spans should be equal size. * */ virtual Result validate( Span images, Span detections, const EstimationRequest request, Span> errors) const noexcept = 0; }; /* Implementation details. */ inline IBestShotQualityEstimator::EstimationRequest operator|( IBestShotQualityEstimator::EstimationRequest first, IBestShotQualityEstimator::EstimationRequest second ) { return static_cast( static_cast(first) | static_cast(second) ); } } // namespace fsdk