DetectionSequence.h 2.5 KB

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