ObjectData3D.h 2.2 KB

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