TwoStage.h 2.3 KB

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