Blame view

src/ai_engine_module/RegionLeave.h 1.37 KB
7cf9e4fe   Hu Chunming   人员区域离开、人员逃散、车辆区域离开
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
  #ifndef __REGION_LEAVE_H__
  #define __REGION_LEAVE_H__
  
  #include <deque>
  #include <map>
  #include <vector>
  
  #include "opencv2/highgui/highgui.hpp"
  
  #include "ai_engine_header.h"
  #include "../ai_platform/task_param_manager.h"
  #include "../decoder/interface/DeviceMemory.hpp"
  #include "../reprocessing_module/save_snapshot_reprocessing.h"
  
  
  class RegionLeave {
  public:
    RegionLeave();
    ~RegionLeave();
  
    void init(int devId, algorithm_type_t eType);
  
    bool add_task(const string &task_id, const int width, const int height);
  
    void process(std::vector<DeviceMemory*>& vec_gpuMem, const std::vector<onelevel_det_result> &det_result, const vector<vector<int>> &delete_objs);
  
    void release_task(string task_id);
  
  #ifdef POST_USE_RABBITMQ
  	typedef std::function<bool(const char *msg)> callback_t;
  	void set_callback(callback_t cb);
  #endif
  
  private:
    bool in_rect_analysis(string task_id, const box_t &cur_bos);
  
    bool is_valid_box(string task_id, const box_t &box, const algorithm_type_t &algor_type);
  
  private:
    task_param_manager *m_task_param_manager{nullptr};
    std::map<OBJ_KEY, box_t> obj_to_position_; // 保存物体上一帧的位置,基于非法闯入判断逻辑,上一帧在框外,下一帧闯入禁区
    std::map<std::string, cv::Mat> region_map;
  
    int m_devId{0};
    algorithm_type_t m_eType;
  
    save_snapshot_reprocessing *m_save_util{nullptr};
  };
  
  
  #endif    // __REGION_LEAVE_H__