Visualizer.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //
  2. // Created by wrede on 04.05.16.
  3. //
  4. #ifndef GBMOT_VISUALIZER_H
  5. #define GBMOT_VISUALIZER_H
  6. #include <opencv2/core/core.hpp>
  7. #include <opencv2/opencv.hpp>
  8. #include "../core/DetectionSequence.h"
  9. #include "../core/Tracklet.h"
  10. #include "dirent.h"
  11. #include <chrono>
  12. #include <random>
  13. namespace util
  14. {
  15. /**
  16. * Utility class for visualizing detection sequences or tracks.
  17. */
  18. class Visualizer
  19. {
  20. private:
  21. /**
  22. * Gets the current time in milliseconds.
  23. * @return the current time in ms
  24. */
  25. int GetTime();
  26. public:
  27. /**
  28. * Displays the given sequence in an window.
  29. * Use D for next frame, A for previous frame, F to toggle auto play and
  30. * ESC to exit.
  31. * @param sequence The sequence of detection data to display
  32. * @param image_folder The images to use
  33. * @param title The window title
  34. * @param first_frame The frame to start at
  35. * @param play_fps The FPS to use when auto play is activated.
  36. */
  37. void Display(core::DetectionSequence& sequence,
  38. std::string image_folder, bool output, std::string output_path,
  39. std::string title = "Visualizer", size_t first_frame = 0,
  40. int play_fps = 24);
  41. /**
  42. * Displays the given tracks in an window.
  43. * Use D for next frame, A for previous frame, F to toggle auto play and
  44. * ESC to exit.
  45. * If a grid size greater zero is specified a grid will be overlayed.
  46. *
  47. * @param tracks The tracks to display
  48. * @param image_folder The images to use
  49. * @param title The window title
  50. * @param first_frame The frame to start at
  51. * @param play_fps The FPS to use when auto play is activated
  52. * @param grid_width The number of cells in a row
  53. * @param grid_height The number of cells in a column
  54. */
  55. void Display(std::vector<core::TrackletPtr>& tracks,
  56. std::string image_folder, bool output, std::string output_path,
  57. std::string title = "Visualizer", size_t first_frame = 0,
  58. int play_fps = 24, int grid_width = 0, int grid_height = 0);
  59. };
  60. }
  61. #endif //GBMOT_VISUALIZER_H