|
#pragma once
|
|
|
|
/**
|
|
* @file IHumanWarper.h
|
|
* @brief Image warping base on Human detection
|
|
* @copyright VisionLabs LLC
|
|
* @date 17.11.2019
|
|
* */
|
|
|
|
#include <fsdk/FSDKError.h>
|
|
#include <fsdk/IRefCounted.h>
|
|
#include <fsdk/Types/Detection.h>
|
|
#include <fsdk/Types/Image.h>
|
|
#include <fsdk/Types/Span.h>
|
|
|
|
namespace fsdk {
|
|
|
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
|
DECLARE_SMARTPTR(IHumanWarper);
|
|
#endif
|
|
|
|
/**
|
|
* @brief Human detection area warper interface.
|
|
* @details Performs cropping and resizing of an image for human descriptor extraction.
|
|
* */
|
|
struct IHumanWarper : IRefCounted {
|
|
/**
|
|
* @brief Warp human detection.
|
|
* @param [in] image source image.
|
|
* @param [in] detection detection coordinates in image space.
|
|
* @param [in/out] transformedImage warped image output.
|
|
* @note if transformedImage has the same width, height, format
|
|
* as the standard human warp and the same memory residence as source image has,
|
|
* then output data will be just copied to transformedImage without any memory allocation.
|
|
* New image will be allocated otherwise.
|
|
* @return Result with error code.
|
|
* @see Image, Detection, Result and FSDKError for details.
|
|
* @note image format must be R8G8B8, @see Format.
|
|
* */
|
|
virtual Result<FSDKError>
|
|
warp(
|
|
const Image image,
|
|
const Detection& detection,
|
|
Image& transformedImage) const noexcept = 0;
|
|
|
|
/**
|
|
* @brief Warps humans on multiple images.
|
|
* @param [in] images span of source images.
|
|
* @param [in] detections span of detection coordinates in corresponding source images space.
|
|
* @param [in/out] transformedImages span of input/output images where
|
|
* result will be stored.
|
|
* @note each detection in detections span corresponds to an image where this detection
|
|
* was taken from by the same index(i.e detections[i] <--> images[i]), therefore, if there are
|
|
* multiple detections on the same image user must duplicate those images in order for the first
|
|
* statement to hold true.
|
|
* @note if output images in transformed images span has the same image parameters as the standard warped image,
|
|
* then output data will be just copied to those images without any memory allocation.
|
|
* New images will be allocated otherwise.
|
|
* @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<FSDKError>
|
|
warp(
|
|
Span<const Image> images,
|
|
Span<const Detection> detections,
|
|
Span<Image> transformedImages) const noexcept = 0;
|
|
|
|
};
|
|
|
|
}
|