Visualizer.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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/Definitions.h"
  10. #include "../core/ObjectData3D.h"
  11. #include "../core/Tracklet.h"
  12. #include "dirent.h"
  13. #include <chrono>
  14. #include <random>
  15. namespace visual
  16. {
  17. /**
  18. * Utility class for visualizing detection sequences or tracks.
  19. */
  20. class Visualizer
  21. {
  22. private:
  23. /**
  24. * Gets the current time in milliseconds.
  25. * @return the current time in ms
  26. */
  27. int GetTime();
  28. /**
  29. * Loads the names of all files in the given folder into the given
  30. * vector.
  31. * @param image_folder The folder to read the files from
  32. * @param image_files The vector to store the file names in
  33. */
  34. void LoadImages(std::string image_folder,
  35. std::vector<std::string>& image_files);
  36. public:
  37. /**
  38. * Displays the given sequence in an window.
  39. * Use D for next frame, A for previous frame, F to toggle auto play and
  40. * ESC to exit.
  41. * @param sequence The sequence of detection data to display
  42. * @param image_folder The images to use
  43. * @param title The window title
  44. * @param first_frame The frame to start at
  45. * @param play_fps The FPS to use when auto play is activated.
  46. */
  47. void Display(core::DetectionSequence& sequence,
  48. std::string image_folder,
  49. std::string title = "Visualizer", size_t first_frame = 0,
  50. int play_fps = 24);
  51. /**
  52. * Displays the given tracks in an window.
  53. * Use D for next frame, A for previous frame, F to toggle auto play and
  54. * ESC to exit.
  55. * @param tracks The tracks to display
  56. * @param image_folder The images to use
  57. * @param title The window title
  58. * @param first_frame The frame to start at
  59. * @param play_fps The FPS to use when auto play is activated.
  60. */
  61. void Display(std::vector<core::TrackletPtr>& tracks,
  62. std::string image_folder,
  63. std::string title = "Visualizer", size_t first_frame = 0,
  64. int play_fps = 24);
  65. };
  66. }
  67. #endif //GBMOT_VISUALIZER_H