ObjectDataBox.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // Created by wrede on 09.06.16.
  3. //
  4. #ifndef GBMOT_OBJECTDATABOX_H
  5. #define GBMOT_OBJECTDATABOX_H
  6. #include "ObjectData2D.h"
  7. namespace core
  8. {
  9. class ObjectDataBox;
  10. typedef std::shared_ptr<ObjectDataBox> ObjectDataBoxPtr;
  11. /**
  12. * Class for storing an object detection with an bounding box.
  13. */
  14. class ObjectDataBox : public ObjectData2D
  15. {
  16. private:
  17. static const std::string CONSTRAINT_WIDTH_DIFFERENCE;
  18. static const std::string CONSTRAINT_HEIGHT_DIFFERENCE;
  19. /**
  20. * The size of the bounding box
  21. */
  22. const cv::Point2d size_;
  23. virtual void Print(std::ostream& os) const override;
  24. public:
  25. /**
  26. * Creates a new detection with an bounding box of the given size.
  27. *
  28. * @param frame_index The frame index of the detection
  29. * @param center The center of the bounding box
  30. * @param size The size of the bounding box
  31. */
  32. ObjectDataBox(size_t frame_index, cv::Point2d center, cv::Point2d size);
  33. /**
  34. * Gets the size of the bounding box.
  35. *
  36. * @return The size of the bounding box
  37. */
  38. cv::Point2d GetSize() const;
  39. virtual double CompareTo(ObjectDataPtr obj) const override;
  40. virtual bool IsWithinConstraints(ObjectDataPtr obj,
  41. std::unordered_map<std::string, double> & constraints)
  42. const override;
  43. virtual ObjectDataPtr Interpolate(ObjectDataPtr obj, double fraction) const override;
  44. virtual void Visualize(cv::Mat& image, cv::Scalar& color, double alpha) const override;
  45. virtual std::string ToString(char delimiter) const override;
  46. };
  47. }
  48. #endif //GBMOT_OBJECTDATABOX_H