InfineFilter.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * @Description:
  3. * @Version: 1.0
  4. * @Autor: lishengyin
  5. * @Date: 2022-03-22 14:00:35
  6. * @LastEditors: lishengyin
  7. * @LastEditTime: 2022-05-16 09:19:44
  8. */
  9. #ifndef __INFINEFILTER_H_
  10. #define __INFINEFILTER_H_
  11. #include <memory>
  12. #include <string>
  13. #include <vector>
  14. #include <map>
  15. #include <list>
  16. #include <queue>
  17. #include "cnstream_frame.hpp"
  18. #include "cnstream_module.hpp"
  19. #include "easyinfer/model_loader.h"
  20. #include "easytrack/easy_track.h"
  21. #include "cnstream_frame_va.hpp"
  22. #include "opencv2/highgui/highgui.hpp"
  23. #include "opencv2/imgproc/imgproc.hpp"
  24. #include "opencv2/dnn.hpp"
  25. #include "opencv2/opencv.hpp"
  26. #include "opencv2/highgui.hpp"
  27. #include "opencv2/imgcodecs/imgcodecs.hpp"
  28. #include <rapidjson/document.h>
  29. #include <rapidjson/rapidjson.h>
  30. #include <rapidjson/stringbuffer.h>
  31. #include <rapidjson/writer.h>
  32. #include <ctime>
  33. #include <iostream>
  34. #include <time.h>
  35. #include <cstdlib>
  36. #include <dirent.h>
  37. #include <sys/types.h>
  38. #include <sys/stat.h>
  39. using namespace std;
  40. namespace cnstream{
  41. // Pointer for frame info
  42. using CNFrameInfoPtr = std::shared_ptr<CNFrameInfo>;
  43. /// Pointer for infer object
  44. using CNInferObjectPtr = std::shared_ptr<CNInferObject>;
  45. class InfineFilter : public cnstream::Module, public cnstream::ModuleCreator<InfineFilter> {
  46. using super = cnstream::Module;
  47. public:
  48. explicit InfineFilter(const std::string &name) : super(name) {}
  49. bool Open(cnstream::ModuleParamSet paramSet) override;
  50. void Close() override { std::cout << this->GetName() << " Close called" << std::endl; }
  51. int Process(std::shared_ptr<cnstream::CNFrameInfo> data) override;
  52. bool filter(cv::Mat image, std::shared_ptr<cnstream::CNInferObject>& object);
  53. bool getNight();
  54. std::string getTime();
  55. private:
  56. InfineFilter(const InfineFilter &) = delete;
  57. InfineFilter &operator=(InfineFilter const &) = delete;
  58. vector<std::string> labels;
  59. bool saveFilterResult = true;
  60. bool Night_Filter = true;
  61. std::string files = "./output/";
  62. int start = 21;
  63. int end = 6;
  64. };
  65. };
  66. #endif