defines.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. typedef struct Size3D{
  16. Size3D()
  17. {
  18. }
  19. Size3D(float w, float h, float l)
  20. :
  21. width(w),
  22. height(h),
  23. length(l)
  24. {
  25. }
  26. float length;
  27. float width;
  28. float height;
  29. } Size3D;
  30. typedef struct Rect3D{
  31. Rect3D()
  32. {
  33. }
  34. Rect3D(cv::Point3f c, Size3D s, float y)
  35. :
  36. center(c),
  37. size(s),
  38. yaw(y)
  39. {
  40. }
  41. cv::Point3f center;
  42. Size3D size;
  43. float yaw;
  44. } Rect3D;
  45. ///
  46. /// \brief config_t
  47. ///
  48. typedef std::multimap<std::string, std::string> config_t;
  49. ///
  50. /// \brief The CRegion class
  51. ///
  52. class CRegion
  53. {
  54. public:
  55. CRegion()
  56. : m_type(-1), m_type_name(""), m_confidence(-1)
  57. {
  58. }
  59. CRegion(const Rect3D& rect, const int& type, float confidence)
  60. : m_rect(rect), m_type(type), m_confidence(confidence)
  61. {
  62. RBRect();
  63. }
  64. CRegion(const Rect3D& rect, const std::string& type, float confidence)
  65. : m_rect(rect), m_type_name(type), m_confidence(confidence)
  66. {
  67. RBRect();
  68. }
  69. Rect3D m_rect;
  70. cv::RotatedRect m_rrect;
  71. cv::Rect m_brect;
  72. int m_type = -1;
  73. std::string m_type_name = "";
  74. float m_confidence = -1;
  75. private:
  76. ///
  77. /// \brief B2RRect
  78. /// \return
  79. ///
  80. cv::RotatedRect RBRect()
  81. {
  82. m_rrect = cv::RotatedRect(Point_t(m_rect.center.x,m_rect.center.y), cv::Size(m_rect.size.width,m_rect.size.height), 0);
  83. m_brect = cv::Rect(m_rect.center.x-m_rect.size.width/2,m_rect.center.y-m_rect.size.height/2, m_rect.size.width,m_rect.size.height);
  84. return m_rrect;
  85. }
  86. };
  87. typedef std::vector<CRegion> regions_t;
  88. ///
  89. ///
  90. ///
  91. namespace tracking
  92. {
  93. ///
  94. /// \brief The DistType enum
  95. ///
  96. enum DistType
  97. {
  98. DistCenters, // Euclidean distance between centers, pixels
  99. DistRects, // Euclidean distance between bounding rectangles, pixels
  100. DistRect3Ds, // Euclidean distance between bounding rectangles, pixels
  101. DistsCount
  102. };
  103. ///
  104. /// \brief The FilterGoal enum
  105. ///
  106. enum FilterGoal
  107. {
  108. FilterCenter, // x,y
  109. FilterRect, // x,y,w,h
  110. FilterRect3D // x,y,z,w,h,l,yaw
  111. };
  112. ///
  113. /// \brief The KalmanType enum
  114. ///
  115. enum KalmanType
  116. {
  117. KalmanLinear
  118. };
  119. ///
  120. /// \brief The MatchType enum
  121. ///
  122. enum MatchType
  123. {
  124. MatchHungrian
  125. };
  126. ///
  127. /// \brief The LostTrackType enum
  128. ///
  129. enum LostTrackType
  130. {
  131. TrackNone
  132. };
  133. }