defines.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. #pragma once
  2. #include <vector>
  3. #include <string>
  4. #include <map>
  5. #include <opencv2/opencv.hpp>
  6. // ---------------------------------------------------------------------------
  7. //
  8. // ---------------------------------------------------------------------------
  9. typedef float track_t;
  10. typedef cv::Point_<track_t> Point_t;
  11. #define El_t CV_32F
  12. #define Mat_t CV_32FC
  13. typedef std::vector<int> assignments_t;
  14. typedef std::vector<track_t> distMatrix_t;
  15. ///
  16. /// \brief config_t
  17. ///
  18. typedef std::multimap<std::string, std::string> config_t;
  19. ///
  20. /// \brief The CRegion class
  21. ///
  22. class CRegion
  23. {
  24. public:
  25. CRegion()
  26. : m_type(""), m_confidence(-1)
  27. {
  28. }
  29. CRegion(const cv::Rect& rect)
  30. : m_brect(rect)
  31. {
  32. B2RRect();
  33. }
  34. CRegion(const cv::RotatedRect& rrect)
  35. : m_rrect(rrect)
  36. {
  37. R2BRect();
  38. }
  39. CRegion(const cv::Rect& rect, const std::string& type, float confidence)
  40. : m_brect(rect), m_type(type), m_confidence(confidence)
  41. {
  42. B2RRect();
  43. }
  44. CRegion(const cv::RotatedRect& rrect, const std::string& type, float confidence)
  45. : m_rrect(rrect), m_type(type), m_confidence(confidence)
  46. {
  47. R2BRect();
  48. }
  49. cv::RotatedRect m_rrect;
  50. cv::Rect m_brect;
  51. std::string m_type;
  52. float m_confidence = -1;
  53. mutable cv::Mat m_hist;
  54. private:
  55. ///
  56. /// \brief R2BRect
  57. /// \return
  58. ///
  59. cv::Rect R2BRect()
  60. {
  61. m_brect = m_rrect.boundingRect();
  62. return m_brect;
  63. }
  64. ///
  65. /// \brief B2RRect
  66. /// \return
  67. ///
  68. cv::RotatedRect B2RRect()
  69. {
  70. m_rrect = cv::RotatedRect(m_brect.tl(), cv::Point2f(static_cast<float>(m_brect.x + m_brect.width), static_cast<float>(m_brect.y)), m_brect.br());
  71. return m_rrect;
  72. }
  73. };
  74. typedef std::vector<CRegion> regions_t;
  75. ///
  76. ///
  77. ///
  78. namespace tracking
  79. {
  80. ///
  81. /// \brief The Detectors enum
  82. ///
  83. enum Detectors
  84. {
  85. Motion_VIBE,
  86. Motion_MOG,
  87. Motion_GMG,
  88. Motion_CNT,
  89. Motion_SuBSENSE,
  90. Motion_LOBSTER,
  91. Motion_MOG2,
  92. Face_HAAR,
  93. Pedestrian_HOG,
  94. Pedestrian_C4,
  95. SSD_MobileNet,
  96. Yolo_OCV,
  97. Yolo_Darknet,
  98. Yolo_TensorRT
  99. };
  100. ///
  101. /// \brief The DistType enum
  102. ///
  103. enum DistType
  104. {
  105. DistCenters, // Euclidean distance between centers, pixels
  106. DistRects, // Euclidean distance between bounding rectangles, pixels
  107. DistJaccard, // Intersection over Union, IoU, [0, 1]
  108. DistHist, // Bhatacharia distance between histograms, [0, 1]
  109. DistsCount
  110. };
  111. ///
  112. /// \brief The FilterGoal enum
  113. ///
  114. enum FilterGoal
  115. {
  116. FilterCenter,
  117. FilterRect
  118. };
  119. ///
  120. /// \brief The KalmanType enum
  121. ///
  122. enum KalmanType
  123. {
  124. KalmanLinear,
  125. KalmanUnscented,
  126. KalmanAugmentedUnscented
  127. };
  128. ///
  129. /// \brief The MatchType enum
  130. ///
  131. enum MatchType
  132. {
  133. MatchHungrian/*,
  134. //MatchBipart*/
  135. };
  136. ///
  137. /// \brief The LostTrackType enum
  138. ///
  139. enum LostTrackType
  140. {
  141. TrackNone,
  142. TrackKCF,
  143. TrackMIL,
  144. TrackMedianFlow,
  145. TrackGOTURN,
  146. TrackMOSSE,
  147. TrackCSRT/*,
  148. TrackDAT,
  149. TrackSTAPLE,
  150. TrackLDES*/
  151. };
  152. }