TwoStage.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // Created by wrede on 25.04.16.
  3. //
  4. #ifndef GBMOT_KOERNERTRACKING_H
  5. #define GBMOT_KOERNERTRACKING_H
  6. #include "../core/DetectionSequence.h"
  7. #include "../core/Tracklet.h"
  8. #include "../graph/Definitions.h"
  9. namespace algo
  10. {
  11. /**
  12. * Implementation of the two-staged graph-based multi-object tracker.
  13. */
  14. class TwoStage
  15. {
  16. private:
  17. /**
  18. * Maximum edge length to link object
  19. */
  20. const size_t max_frame_skip_;
  21. /**
  22. * Edge value to link to source and sink
  23. */
  24. const double penalty_value_;
  25. /**
  26. * Maximum dijkstra iterations / number of tracklets to create
  27. */
  28. const size_t max_tracklet_count_;
  29. public:
  30. /**
  31. * Initializes the algorithm wih the given values.
  32. * @param max_frame_skip The maximum edge length to link objects
  33. * @param penalty_value The Edge value to link to source and sink
  34. * @param max_tracklet_count The maximum number of tracklets to create
  35. */
  36. TwoStage(size_t max_frame_skip, double penalty_value,
  37. size_t max_tracklet_count);
  38. /**
  39. * Creates a graph with vertices for every detected object
  40. * @param graph The graph to write into
  41. * @param detections The objects to use for the graph
  42. */
  43. void CreateObjectGraph(DirectedGraph& graph,
  44. const core::DetectionSequence& detections);
  45. /**
  46. * Reduces the object graph into linked tracklets.
  47. * @param obj_graph The object graph to reduce
  48. * @param tlt_graph The graph to write the tracklets in
  49. * @param frame_count The frame count of the object graph
  50. */
  51. void CreateTrackletGraph(DirectedGraph& obj_graph,
  52. DirectedGraph& tlt_graph,
  53. size_t frame_count);
  54. /**
  55. * Extracts the finished tracks from the given tracklet graph.
  56. * @param tlt_graph The tracklet graph to extract from
  57. * @param depth The depth to flatten the tracklets to
  58. * @param tracks The vector to write the extracted tracks in
  59. */
  60. void ExtractTracks(DirectedGraph& tlt_graph,
  61. size_t depth,
  62. std::vector<core::TrackletPtr>& tracks);
  63. };
  64. }
  65. #endif //GBMOT_KOERNERTRACKING_H