DetectionSequence.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // Created by wrede on 19.04.16.
  3. //
  4. #ifndef GBMOT_DETECTIONSEQUENCE_H
  5. #define GBMOT_DETECTIONSEQUENCE_H
  6. #include <string>
  7. #include "ObjectData.h"
  8. namespace core
  9. {
  10. /**
  11. * Class for storing a full sequence of frame, each with multiple
  12. * detected objects.
  13. */
  14. class DetectionSequence
  15. {
  16. private:
  17. /**
  18. * Display name
  19. */
  20. std::string name_;
  21. /**
  22. * Two dimensional vector of pointers to all detected objects.
  23. * The first dimension is the frame.
  24. * The second dimension is the object in that frame.
  25. */
  26. std::vector<std::vector<ObjectDataPtr>> objects_;
  27. public:
  28. /**
  29. * Creates a detection sequence with the given name.
  30. * @param name The name of this sequence
  31. */
  32. DetectionSequence(const std::string& name = "DetectionSequence");
  33. /**
  34. * Adds a new object, creates a new frame vector if the given objects
  35. * frame index is greater than the current frame vector size.
  36. * @param object_data The object to add
  37. */
  38. void AddObject(ObjectDataPtr object_data);
  39. /**
  40. * Removes all objects.
  41. */
  42. void Clear();
  43. /**
  44. * Gets the name of this sequence.
  45. * @return The name
  46. */
  47. std::string GetName() const;
  48. /**
  49. * Gets a pointer to the object in the given frame with the given index.
  50. * @param frame_index The frame to get the object from
  51. * @param object_index The objects index in the corresponding frame
  52. * @return A pointer to the stored object data
  53. */
  54. ObjectDataPtr GetObject(size_t frame_index, size_t object_index) const;
  55. /**
  56. * Gets the frame count.
  57. * @return The frame count
  58. */
  59. size_t GetFrameCount() const;
  60. /**
  61. * Gets the object count in the given frame.
  62. * @param frame_index The frame to get the object count of
  63. * @return The number of objects in this frame
  64. */
  65. size_t GetObjectCount(size_t frame_index) const;
  66. /**
  67. * Overrides the << operator for easy output.
  68. * @param os The stream to write to
  69. * @param obj The object to write into the stream
  70. * @return The stream written to
  71. */
  72. friend std::ostream& operator<<(std::ostream& os,
  73. const DetectionSequence& obj);
  74. };
  75. }
  76. #endif //GBMOT_DETECTIONSEQUENCE_H