DetectionSequence.h 2.5 KB

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