You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.6 KiB

1 year ago
  1. #pragma once
  2. /**
  3. * @file IHumanWarper.h
  4. * @brief Image warping base on Human detection
  5. * @copyright VisionLabs LLC
  6. * @date 17.11.2019
  7. * */
  8. #include <fsdk/FSDKError.h>
  9. #include <fsdk/IRefCounted.h>
  10. #include <fsdk/Types/Detection.h>
  11. #include <fsdk/Types/Image.h>
  12. #include <fsdk/Types/Span.h>
  13. namespace fsdk {
  14. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  15. DECLARE_SMARTPTR(IHumanWarper);
  16. #endif
  17. /**
  18. * @brief Human detection area warper interface.
  19. * @details Performs cropping and resizing of an image for human descriptor extraction.
  20. * */
  21. struct IHumanWarper : IRefCounted {
  22. /**
  23. * @brief Warp human detection.
  24. * @param [in] image source image.
  25. * @param [in] detection detection coordinates in image space.
  26. * @param [in/out] transformedImage warped image output.
  27. * @note if transformedImage has the same width, height, format
  28. * as the standard human warp and the same memory residence as source image has,
  29. * then output data will be just copied to transformedImage without any memory allocation.
  30. * New image will be allocated otherwise.
  31. * @return Result with error code.
  32. * @see Image, Detection, Result and FSDKError for details.
  33. * @note image format must be R8G8B8, @see Format.
  34. * */
  35. virtual Result<FSDKError>
  36. warp(
  37. const Image image,
  38. const Detection& detection,
  39. Image& transformedImage) const noexcept = 0;
  40. /**
  41. * @brief Warps humans on multiple images.
  42. * @param [in] images span of source images.
  43. * @param [in] detections span of detection coordinates in corresponding source images space.
  44. * @param [in/out] transformedImages span of input/output images where
  45. * result will be stored.
  46. * @note each detection in detections span corresponds to an image where this detection
  47. * was taken from by the same index(i.e detections[i] <--> images[i]), therefore, if there are
  48. * multiple detections on the same image user must duplicate those images in order for the first
  49. * statement to hold true.
  50. * @note if output images in transformed images span has the same image parameters as the standard warped image,
  51. * then output data will be just copied to those images without any memory allocation.
  52. * New images will be allocated otherwise.
  53. * @return Result with error code.
  54. * @see Span, Image, Detection, Result and FSDKError for details.
  55. * @note images format must be R8G8B8, @see Format.
  56. * @note all spans should be based on user owned continuous collections.
  57. * @note all spans should be equal size.
  58. * */
  59. virtual Result<FSDKError>
  60. warp(
  61. Span<const Image> images,
  62. Span<const Detection> detections,
  63. Span<Image> transformedImages) const noexcept = 0;
  64. };
  65. }