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.

222 lines
8.1 KiB

1 year ago
  1. #pragma once
  2. #include "TrackEngineTypes.h"
  3. #include <fsdk/Types/Span.h>
  4. namespace tsdk {
  5. /**
  6. * @brief BestShot observer interface
  7. */
  8. struct TRACK_ENGINE_API IBatchBestShotObserver {
  9. /**
  10. * @brief Ready portrait notification for streams
  11. * @param streamIDs ids of the streams.
  12. * @param data callback data. see 'BestShotCallbackData' for details
  13. * Do not delete it under no circumstances.
  14. * @note pure virtual method
  15. */
  16. virtual void bestShot(const fsdk::Span<tsdk::StreamId> &streamIDs,
  17. const fsdk::Span<tsdk::BestShotCallbackData> &data) = 0;
  18. /**
  19. * @brief End of the tracks notification for streams
  20. * @param streamIDs ids of the streams.
  21. * @param data callback data. see 'TrackEndCallbackData' for details
  22. * @note pure virtual method
  23. * @note See 'TrackEndCallbackData' struct comments for more information about logic of this callback
  24. */
  25. virtual void trackEnd(const fsdk::Span<tsdk::StreamId> &streamIDs,
  26. const fsdk::Span<tsdk::TrackEndCallbackData> &data) = 0;
  27. /**
  28. * @brief status of the track update notification for streams.
  29. * @param streamIDs ids of the streams.
  30. * @param data callback data. see 'TrackStatusUpdateCallbackData' for details
  31. * @note pure virtual method
  32. */
  33. virtual void trackStatusUpdate(const fsdk::Span<tsdk::StreamId> &streamIDs,
  34. const fsdk::Span<tsdk::TrackStatusUpdateCallbackData> &data) = 0;
  35. /**
  36. * @brief ReIdentification of the old non-active tracks notification for streams.
  37. * The callback serves to connect two matched tracks: first one is from the current tracks and second one is from the old non-active tracks.
  38. * See human tracking algorithm section in docs for details.
  39. * @param streamIDs ids of the streams.
  40. * @param data callback data. see 'TrackReIdentificateCallbackData' for details
  41. * @note the callback's called only for human tracking in the current version of the Track Engine
  42. * @note after 'trackReIdentificate' 'trackEnd' may be called for the current track id to indicate, that this id doesn't exist anymore
  43. */
  44. virtual void trackReIdentificate(const fsdk::Span<tsdk::StreamId> &streamIDs,
  45. const fsdk::Span<tsdk::TrackReIdentificateCallbackData> &data) = 0;
  46. virtual ~IBatchBestShotObserver() = default;
  47. };
  48. /** @brief Ready track observer interface
  49. */
  50. struct TRACK_ENGINE_API IBatchVisualObserver {
  51. /**
  52. * @brief Ready track notification
  53. * @param streamIDs ids of the streams.
  54. * @param data callback data. see 'VisualCallbackData' for details
  55. * Do not remove it under no circumstances.
  56. * @note pure virtual method
  57. */
  58. virtual void visual(const fsdk::Span<tsdk::StreamId> &streamIDs,
  59. const fsdk::Span<tsdk::VisualCallbackData> &data) = 0;
  60. virtual ~IBatchVisualObserver() = default;
  61. };
  62. /** @brief Debug information observer interface
  63. */
  64. struct TRACK_ENGINE_API IBatchDebugObserver {
  65. /**
  66. * @brief Debug callback for the foreground subtractor
  67. * @param streamIDs ids of the streams.
  68. * @param data callback data. see 'DebugForegroundSubtractionCallbackData' for details
  69. */
  70. virtual void debugForegroundSubtraction(const fsdk::Span<tsdk::StreamId> &streamIDs,
  71. const fsdk::Span<tsdk::DebugForegroundSubtractionCallbackData> &data) = 0;
  72. /**
  73. * @brief Debug callback for the detection
  74. * @param streamIDs ids of the streams.
  75. * @param data callback data. see 'DebugDetectionCallbackData' for details
  76. */
  77. virtual void debugDetection(const fsdk::Span<tsdk::StreamId> &streamIDs,
  78. const fsdk::Span<tsdk::DebugDetectionCallbackData> &data) = 0;
  79. virtual ~IBatchDebugObserver() = default;
  80. };
  81. /**
  82. * @brief BestShot observer interface
  83. */
  84. struct IBestShotObserver {
  85. /**
  86. * @brief Ready portrait notification
  87. * @param ReadyFace portrait, @see ReadyFace
  88. * @param data any additional frame data from source. Absolutely the same data you pass into pushFrame().
  89. * Do not remove it under no circumstances.
  90. * @note pure virtual method
  91. */
  92. TRACK_ENGINE_API virtual void bestShot(const tsdk::DetectionDescr& descr, const tsdk::AdditionalFrameData* data) = 0;
  93. /**
  94. * @brief End of the track notification.
  95. * @param trackId id of the track which was finished.
  96. * @note pure virtual method
  97. */
  98. TRACK_ENGINE_API virtual void trackEnd(const tsdk::TrackId& trackId) = 0;
  99. /**
  100. * @brief status of the track update notification.
  101. * @param trackId id of the track with status updated.
  102. * @param status track status.
  103. */
  104. TRACK_ENGINE_API virtual void trackStatusUpdate(tsdk::FrameId frameId, tsdk::TrackId trackId, tsdk::TrackStatus status) {
  105. };
  106. /**
  107. * @brief ReIdentification of the old non-active tracks notification for streams.
  108. * The callback serves to connect two matched tracks: first one is from the current tracks and second one is from the old non-active tracks.
  109. * See human tracking algorithm section in docs for details.
  110. * @param frameId id of frame
  111. * @param trackId id of track, that was matched to one of the old non-active tracks
  112. * @param reidTrackId id of the non-active track, that successfully mathed to track with id = 'trackId'
  113. * @note the callback's called only for human tracking in the current version of the Track Engine
  114. * @note after 'trackReIdentificate' 'trackEnd' may be called for the current track id to indicate, that this id doesn't exist anymore
  115. */
  116. TRACK_ENGINE_API virtual void trackReIdentificate(tsdk::FrameId frameId, tsdk::TrackId trackId, tsdk::TrackId reidTrackId) {
  117. }
  118. TRACK_ENGINE_API virtual ~IBestShotObserver() = default;
  119. };
  120. /**
  121. * @brief Ready track observer interface
  122. */
  123. struct IVisualObserver {
  124. /**
  125. * @brief Ready track notification
  126. * @param frameId id of the frame
  127. * @param fsdk::image this is either original image (if 'pushFrame' used) or RGB image got from custom frame convert (is 'pushCustomFrame' used)
  128. * @param tsdk::TrackInfo* pointer to array of track information
  129. * @param int nTrack size of array of track
  130. * @param data any additional frame data from source. Absolutely the same data you pass into pushFrame().
  131. * Do not remove it under no circumstances.
  132. * @note pure virtual method
  133. */
  134. TRACK_ENGINE_API virtual void visual(
  135. const tsdk::FrameId &frameId,
  136. const fsdk::Image &image,
  137. const tsdk::TrackInfo * trackInfo,
  138. const int nTrack,
  139. const tsdk::AdditionalFrameData* data) = 0;
  140. TRACK_ENGINE_API virtual ~IVisualObserver() = default;
  141. };
  142. /**
  143. * @brief Debug information observer interface
  144. */
  145. struct IDebugObserver {
  146. /**
  147. * @brief Debug callback for the foreground subtractor
  148. * @param frameId id of the frame
  149. * @param firstMask first mask of the frg subtractor
  150. * @param secondMask second mask of the frg subtractor
  151. * @param regions detected regions
  152. * @param nRegions count of the regions
  153. */
  154. TRACK_ENGINE_API virtual void debugForegroundSubtraction(
  155. const tsdk::FrameId& frameId,
  156. const fsdk::Image& firstMask,
  157. const fsdk::Image& secondMask,
  158. fsdk::Rect * regions,
  159. int nRegions
  160. ) {
  161. };
  162. /**
  163. * @brief Debug callback for the detection
  164. * @param descr debug information about detection.
  165. */
  166. TRACK_ENGINE_API virtual void debugDetection(
  167. const tsdk::DetectionDebugInfo& descr) {
  168. };
  169. TRACK_ENGINE_API virtual ~IDebugObserver() = default;
  170. };
  171. /** @brief Best shot predicate
  172. * @note Logic for checking if current shot could be the best shot candidate
  173. */
  174. struct TRACK_ENGINE_API IBestShotPredicate {
  175. /**
  176. * @brief Check if current shot is the best shot candidate
  177. * @param descr detection descriptor, @see tsdk::DetectionDescr
  178. * @param data any additional frame data from source. Absolutely the same data you pass into pushFrame().
  179. * Do not remove it under no circumstances.
  180. * @return true if current shot could be the best shot candidate, false otherwise
  181. * @note pure virtual method
  182. */
  183. virtual bool checkBestShot(const tsdk::DetectionDescr& descr, const tsdk::AdditionalFrameData *data) = 0;
  184. virtual ~IBestShotPredicate() = default;
  185. };
  186. /** @brief Visual predicate
  187. * @note Logic for checking if original or converted RGB image is needed in visual callback data (useful, when client uses 'pushCustomFrame')
  188. */
  189. struct TRACK_ENGINE_API IVisualPredicate {
  190. virtual bool needRGBImage(const tsdk::FrameId frameId, const tsdk::AdditionalFrameData*) = 0;
  191. virtual ~IVisualPredicate() = default;
  192. };
  193. }