data.hpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef DATA_HPP__
  2. #define DATA_HPP__
  3. #include <string>
  4. #include <vector>
  5. #include <map>
  6. #include <iostream>
  7. namespace data
  8. {
  9. struct Point
  10. {
  11. float x;
  12. float y;
  13. float score;
  14. Point() : x(0), y(0), score(0) {}
  15. Point(float x, float y, float score) : x(x), y(y), score(score) {}
  16. Point(const Point& p) : x(p.x), y(p.y), score(p.score) {}
  17. Point& operator=(const Point& p)
  18. {
  19. x = p.x;
  20. y = p.y;
  21. score = p.score;
  22. return *this;
  23. }
  24. };
  25. struct Box
  26. {
  27. float left;
  28. float top;
  29. float right;
  30. float bottom;
  31. float score;
  32. std::string label;
  33. // 是否需要二次分类
  34. bool need_classification;
  35. std::vector<Point> points;
  36. Box() : left(0), top(0), right(0), bottom(0), score(0), label(""), need_classification(false) {}
  37. Box(float left, float top, float right, float bottom, float score, const std::string& label, bool need_classification = false)
  38. : left(left), top(top), right(right), bottom(bottom), score(score), label(label), need_classification(need_classification) {}
  39. Box(const Box& b) : left(b.left), top(b.top), right(b.right), bottom(b.bottom), score(b.score), label(b.label), need_classification(b.need_classification), points(b.points) {}
  40. Box(const Box&& b) : left(b.left), top(b.top), right(b.right), bottom(b.bottom), score(b.score), label(b.label), need_classification(b.need_classification), points(b.points) {}
  41. Box& operator=(const Box& b)
  42. {
  43. left = b.left;
  44. top = b.top;
  45. right = b.right;
  46. bottom = b.bottom;
  47. score = b.score;
  48. label = b.label;
  49. need_classification = b.need_classification;
  50. points = b.points;
  51. return *this;
  52. }
  53. };
  54. using BoxArray = std::vector<Box>;
  55. } // namespace data
  56. #endif // DATA_HPP__