ObjectData3D.h 2.2 KB

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