ObjectData2D.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // Created by wrede on 02.06.16.
  3. //
  4. #ifndef GBMOT_OBJECTDATA2D_H
  5. #define GBMOT_OBJECTDATA2D_H
  6. #include "ObjectData.h"
  7. namespace core
  8. {
  9. class ObjectData2D;
  10. typedef std::shared_ptr<ObjectData2D> ObjectData2DPtr;
  11. /**
  12. * Class for storing a detection in two dimensional space.
  13. */
  14. class ObjectData2D : public ObjectData
  15. {
  16. private:
  17. /**
  18. * The position in the two dimensional space
  19. */
  20. const cv::Point2d position_;
  21. /**
  22. * The weight of the temporal distance for the comparison.
  23. * The temporal distance is the frame difference.
  24. */
  25. double temporal_weight_;
  26. /**
  27. * The weight of the spatial distance for the comparison.
  28. * The spatial distance is the euclidean distance of the positions.
  29. */
  30. double spatial_weight_;
  31. virtual void Print(std::ostream& os) const override;
  32. public:
  33. /**
  34. * Creates a new detection with the given index and position.
  35. * @param frame_index The frame index
  36. * @param position The position in three dimensional space
  37. */
  38. ObjectData2D(size_t frame_index, cv::Point2d position);
  39. /**
  40. * Sets the temporal weight.
  41. * @param weight The temporal weight
  42. */
  43. void SetTemporalWeight(double weight);
  44. /**
  45. * Sets the spatial weight
  46. * @param weight The spatial weight
  47. */
  48. void SetSpatialWeight(double weight);
  49. /**
  50. * Gets the position in two dimensional space.
  51. * @return The position
  52. */
  53. cv::Point2d GetPosition() const;
  54. /**
  55. * Gets the temporal weight.
  56. * @return The temporal weight
  57. */
  58. double GetTemporalWeight() const;
  59. /**
  60. * Gets the spatial weight
  61. * @return The spatial weight
  62. */
  63. double GetSpatialWeight() const;
  64. virtual double CompareTo(ObjectDataPtr obj) const override;
  65. virtual ObjectDataPtr Interpolate(ObjectDataPtr obj, double fraction) const override;
  66. virtual void Visualize(cv::Mat& image, cv::Scalar& color) const override;
  67. virtual std::string ToString(char delimiter) const override;
  68. };
  69. }
  70. #endif //GBMOT_OBJECTDATA2D_H