ObjectDataAngular.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //
  2. // Created by wrede on 19.05.16.
  3. //
  4. #ifndef GBMOT_OBJECTDATAANGULAR_H
  5. #define GBMOT_OBJECTDATAANGULAR_H
  6. #include "ObjectData2D.h"
  7. namespace core
  8. {
  9. class ObjectDataAngular;
  10. typedef std::shared_ptr<ObjectDataAngular> ObjectDataAngularPtr;
  11. /**
  12. * Class for storing a detection in two dimensional space with an rotation
  13. * angle in radians.
  14. */
  15. class ObjectDataAngular : public ObjectData2D
  16. {
  17. private:
  18. static const std::string CONSTRAINT_ANGULAR_DIFFERENCE;
  19. /**
  20. * The rotation angle in radians
  21. */
  22. double angle_;
  23. /**
  24. * The weight of the angular difference for the comparison
  25. */
  26. double angular_weight_;
  27. virtual void Print(std::ostream& os) const override;
  28. public:
  29. /**
  30. * Creates a new object in the given frame, with the given position and
  31. * the given angle.
  32. * @param frame_index The index of the frame
  33. * @param position The position in two dimensional space
  34. * @param angle The rotation angle in radians
  35. */
  36. ObjectDataAngular(size_t frame_index, const cv::Point2d& position, double angle);
  37. /**
  38. * Creates a new object in the given frame, with the given position and
  39. * the given angle. The weights are used in the comparison calculation.
  40. * @param frame_index The index of the frame
  41. * @param position The position in two dimensional space
  42. * @param angle The rotation angle in radians
  43. * @param temporal_weight The temporal weight
  44. * @param spatial_weight The spatial weight
  45. * @param angular_weight The angular weight
  46. */
  47. ObjectDataAngular(size_t frame_index, const cv::Point2d& position,
  48. double angle, double temporal_weight,
  49. double spatial_weight, double angular_weight);
  50. /**
  51. * Sets the angular weight.
  52. * @param weight The angular weight
  53. */
  54. void SetAngularWeight(double weight);
  55. /**
  56. * Gets the rotation angle in radians.
  57. * @return The rotation angle in radians
  58. */
  59. double GetAngle() const;
  60. /**
  61. * Gets the angular weight.
  62. * @return The angular weight
  63. */
  64. double GetAngularWeight() const;
  65. virtual double CompareTo(ObjectDataPtr obj) const override;
  66. virtual bool IsWithinConstraints(ObjectDataPtr obj,
  67. std::unordered_map<std::string, double> & constraints)
  68. const override;
  69. virtual ObjectDataPtr Interpolate(ObjectDataPtr obj, double fraction) const override;
  70. virtual void Visualize(cv::Mat& image, cv::Scalar& color, double alpha) const override;
  71. virtual std::string ToString(char delimiter) const override;
  72. };
  73. }
  74. #endif //GBMOT_OBJECTDATAANGULAR_H