DetectionSequence.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 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<ObjectData>> objects_;
  29. protected:
  30. /**
  31. * Used in the << operator
  32. * @param os The stream to write to
  33. */
  34. virtual void Print(std::ostream& os) const;
  35. public:
  36. /**
  37. * Creates a detection sequence with the given name.
  38. * @param name The name of this sequence
  39. */
  40. DetectionSequence(std::string name);
  41. /**
  42. * Adds a new object, creates a new frame vector if the given objects
  43. * frame index is greater than the current frame vector size.
  44. * @param object_data The object to add
  45. */
  46. void AddObject(ObjectData object_data);
  47. /**
  48. * Removes all objects.
  49. */
  50. void Clear();
  51. /**
  52. * Gets the name of this sequence.
  53. * @return The name
  54. */
  55. std::string GetName() const;
  56. /**
  57. * Gets the object in the given frame with the given index.
  58. * @param frame_index The frame to get the object from
  59. * @param object_index The objects index in the corresponding frame
  60. */
  61. ObjectData GetObject(size_t frame_index, size_t object_index);
  62. /**
  63. * Gets the frame count.
  64. * @return The frame count
  65. */
  66. size_t GetFrameCount() const;
  67. /**
  68. * Gets the object count in the given frame.
  69. * @param frame_index The frame to get the object count of
  70. * @return The number of object in this frame
  71. */
  72. size_t GetObjectCount(size_t frame_index) const;
  73. /**
  74. * Overrides the << operator for easy output.
  75. * Calls the print method.
  76. * @param os The stream to write to
  77. * @param obj The object to write into the stream
  78. * @return The stream written to
  79. */
  80. friend std::ostream& operator<<(std::ostream& os, const DetectionSequence& obj);
  81. };
  82. }
  83. #endif //GBMOT_DETECTIONSEQUENCE_H