Blame view

src/reprocessing_module/save_snapshot_reprocessing.h 1.42 KB
09c2d08c   Hu Chunming   arm交付版
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
  /*
   * @Author: yangzilong
   * @Date: 2021-12-14 17:51:04
   * @Last Modified by: yangzilong
   * @Email: yangzilong@objecteye.com
   * @Description:
   */
  #pragma once
  #include "opencv2/opencv.hpp"
  #include "opencv2/highgui/highgui.hpp"
  #include <string.h>
  #include <queue>
  #include <mutex>
  #include <condition_variable>
  #include <thread>
  
  #include "../ai_platform/det_obj_header.h"
  #include "../util/JpegUtil.h"
  #include "../util/vpc_util.h"
  
  #ifdef POST_USE_RABBITMQ
  #include "post_reprocessing.hpp"
  #include <memory>
  #endif // #ifdef POST_USE_RABBITMQ
  
  using namespace std;
  
39b31e88   Hu Chunming   添加人员攀爬、人员越线、车辆压线
28
29
  #define SAVE_THREAD_COUNT	32
  
09c2d08c   Hu Chunming   arm交付版
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  class DeviceMemory;
  
  struct ImgSaveInfo{
  	string file_path {""};
  	vpc_img_info img_info;
  	string json_str {""};
  	sy_rect obj_rect;
  };
  
  class save_snapshot_reprocessing
  {
  public:
  	save_snapshot_reprocessing(int devId);
  	~save_snapshot_reprocessing();
  	void save_snapshot_reprocessing_release();
  
  #ifdef POST_USE_RABBITMQ
  	typedef std::function<bool(const char *msg)> callback_t;
  	void set_callback(callback_t cb);
  #endif
  
  	void reprocessing_process_wo_locus_async(ImgSaveInfo saveInfo);
  
  public:
  	void save_img_process();
  
  private:
  
  	queue<ImgSaveInfo> waitforsave_img_queue;
  	mutable std::mutex waitforsave_img_queue_mutex;
39b31e88   Hu Chunming   添加人员攀爬、人员越线、车辆压线
60
  	std::thread m_save_img_thread[SAVE_THREAD_COUNT];
09c2d08c   Hu Chunming   arm交付版
61
62
63
64
65
66
67
68
69
70
71
  
  	bool bFinish = false;
  	int m_devId;
  
  	JpegUtil jpegUtil;
  
  #ifdef POST_USE_RABBITMQ
  	callback_t callback_;
  	std::shared_ptr<mq::post_rabbitmq_reprocessing> rbmq_handler_;
  #endif
  };