InferVideo.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #include <iostream>
  3. #include <list>
  4. #include <opencv2/core.hpp>
  5. #include <opencv2/videoio.hpp>
  6. #include <opencv2/highgui.hpp>
  7. #include <opencv2/imgproc.hpp>
  8. #include <opencv2/imgproc/types_c.h>
  9. #include <time.h>
  10. #include <cstdlib>
  11. #include <dirent.h>
  12. #include <sys/types.h>
  13. #include <sys/stat.h>
  14. using namespace std;
  15. using namespace cv;
  16. class InferVideo
  17. {
  18. private:
  19. std::string m_fileName;
  20. string m_enc_type;
  21. string m_outputDir;
  22. int m_fps;
  23. int m_cacheTime;
  24. list<Mat> m_frameBuffer;
  25. int m_count;
  26. int m_videoMaxTime;
  27. Size m_frameSize;
  28. std::shared_ptr<cv::VideoWriter> m_videoWriter;
  29. bool m_videoStart;
  30. std::string pid;
  31. public:
  32. InferVideo(const string &outputDir,const string &enc_type, const int fps, const int videoMaxTime,const int cacheTime,const Size& frameSize);
  33. ~InferVideo();
  34. void Destroy();
  35. bool capture(int num, Mat& dst);
  36. string getFileName();
  37. int getVideoFps();
  38. int getVideoTime();
  39. void setPid(std::string Pid){
  40. this->pid = Pid;
  41. }
  42. };