#pragma once #include "FSDKError.h" #include "IHumanDetectionBatch.h" #include "IObject.h" #include "Types/Human.h" namespace fsdk { #ifndef DOXYGEN_SHOULD_SKIP_THIS DECLARE_SMARTPTR(IHumanDetector); #endif /** * @defgroup DetectorGroup Human detector. * @brief Human detector public interfaces and related types and structures. * @{ * */ /** * @brief Human detection type enumeration. * */ enum HumanDetectionType { HDT_BOX = 0, //!< Get bounding boxes of human bodies. HDT_POINTS = 1<<0, //!< Get 17 keypoints of human, with score for each one. HDT_ALL = 0xffff //!< Get all supported parameters. }; inline HumanDetectionType operator | (HumanDetectionType a, HumanDetectionType b) { return static_cast(static_cast(a) | static_cast(b)); } /** * @brief human body detector interface. * */ struct IHumanDetector : IRefCounted { /** * @brief Batched detect of human bodies. * @param [in] images span of source images. * @param [in] rects span of input rectangles of interest. * @param [in] detectionPerImageNum max number of detections per input image. * @param [in] type Human detection type. * @return ResultValue with error code and IHumanDetectionBatch object. * @see Ref, Span, Image, Rect, IHumanDetectionBatch, HumanDetectionType, ResultValue 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 ResultValue> detect( Span images, Span rects, uint32_t detectionPerImageNum, HumanDetectionType type = HDT_BOX) const noexcept = 0; /** * @brief Detect one person on input image. * @param [in] image source image. * @param [in] rect rectangle of interest in the image. * @param [in] type Human detection type. * @return ResultValue with ErrorCode and Human (invalid - if detection not found). * @see Image, Rect, Human, HumanDetectionType, ResultValue and FSDKError for details. * @note image format must be R8G8B8, @see Format. */ virtual ResultValue detectOne( const Image& image, const Rect& rect, HumanDetectionType type = HDT_BOX) const noexcept = 0; /** * @brief redetect one person from input image. * @param [in] image source image. * @param [in] detection span of detection coordinates in corresponding source images space to make a redetect. * @param [in] type Human detection type. * @return ResultValue with ErrorCode and Human (invalid - if detection not found). * @see Image, Detection, Human, HumanDetectionType, ResultValue and FSDKError for details. * @note image format must be R8G8B8, @see Format. **/ virtual ResultValue redetectOne( const Image& image, const Detection& detection, HumanDetectionType type = HDT_BOX) const noexcept = 0; /** * @brief Batched redetect humans on multiple images * based on the detection results for the previous frames. * @param [in] images span of source images. * @param [in] detectionBatch result of detection on the previous frames - * Ref with an IHumanDetectionBatch object. * @param [in] type type of redetection. * @return ResultValue with error code and IHumanDetectionBatch object. * @see Ref, Span, Image, IHumanDetectionBatch, HumanDetectionType, ResultValue and FSDKError for details. * @note images format must be R8G8B8, @see Format. * @note all spans should be based on user owned continuous collections. * @note images span should be the same size with detectionBatch size. * @note In case if some human from the input detectionBatch was not found * the corresponding detection in the output IHumanDetectionBatch object * will be invalid. */ virtual ResultValue redetect( Span images, Ref detectionBatch, HumanDetectionType type = HDT_BOX) const noexcept = 0; /** * @brief Batched redetect humans on multiple images * based on the detection results for the previous frames. * @param [in] images span of source images. * @param [in] detections span of detection coordinates in corresponding source images space * from the previous frames. It is a two dimensional Span. There is one Span of the rectangles for each image. * @param [in] type type of redetection. * @return ResultValue with error code and IHumanDetectionBatch object. * @see Span, Image, Detection, IHumanDetectionBatch, HumanDetectionType, ResultValue 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. * @note If for some of the input detections the redetected human will not be found the * appropriate detection in the IHumanDetectionBatch object will be invalid. */ virtual ResultValue redetect( Span images, Span> detections, HumanDetectionType type = HDT_BOX) const noexcept = 0; /** * @brief Validate input of multiple frames in a single function call. * @param [in] images span of source images. * @param [in] rects span of rectangle coordinates of corresponding source images. * @param [in] detectionPerImageNum max number of detections per input image. * @param [out] errors output span of errors for each image. * @return Result with error code. * @see Span, Image, Rect, 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 rects, uint32_t detectionPerImageNum, Span> errors) const noexcept = 0; /** * @brief Validate input of multiple frames in a single function call. * @param [in] images span of source images. * @param [in] detectionBatch result of detection on the previous frames - * Ref with an IHumanDetectionBatch object. * @param [out] errors output span of errors for each image. * @return Result with error code. * @see Ref, Span, Image, IHumanDetectionBatch, 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, Ref detectionBatch, Span> errors) const noexcept = 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 * from the previous frames. It is a two dimensional Span. There is one Span of the Detections for each image. * @param [out] errors output span of errors for each image. * It is a two dimensional Span. There is one Span of the errors for each image. * @return Result with error code. * @see Span, Image, Detection, 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, Span>> errors) const noexcept = 0; }; /** @} */ }