Blame view

tsl_aiplatform/reprocessing_module/snapshot_reprocessing.h 3.28 KB
85cc8cb9   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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
  /*
   * @Author: yangzilong
   * @Date: 2021-12-17 20:27:57
   * @Last Modified by: yangzilong
   * @Email: yangzilong@objecteye.com
   * @Description:
   */
  #pragma once
  
  #include "utools.h"
  #include "stl_aiplatform_header.h"
  #include <vector>
  #include <set>
  #include <string>
  #include <map>
  #include <bitset>
  #include "task_param_manager.h"
  #include "mvpt_process_assist.h"
  #include "../helpers/cuda_helper.h"
  // #define EXPANSION_PROPORTION 0.1
  #define EXPANSION_PROPORTION 0.25 
  #define FACE_EXPANSION_PROPORTION 0.5
  #define IMG_CHANNELS 3
  
  
  
  // using namespace std;
  using std::vector;
  using std::map;
  using std::set;
  
  class snapshot_reprocessing
  {
  public:
  	//更新最优快照
  	static snapshot_reprocessing* getInstance()
  	{
  		static snapshot_reprocessing snapshot_reprocessing_instance;
  		return &snapshot_reprocessing_instance;
  	}
  
  	/**
  	* @brief
  	*
  	* @param taskin_play_id [in]:
  	* @param images [in]:
  	* @param ol_det_result [in]:
  	* @param delete_object_id [in]: nothing ???
  	* @return int
  	*/
  	int update_bestsnapshot(set<string>& task_in_play_id, sy_img* images, vector<onelevel_det_result> &ol_det_result, vector<vector<int>>& delete_object_id);
  	int update_face_bestsnapshot(set<string>& task_in_play_id, sy_img* images, vector<onelevel_det_result> &ol_det_result, vector<vector<int>>& delete_object_id);
  
  	void snapshot_reprocessing_release();
  
  private:
  	snapshot_reprocessing();
  
  	// 用于记录每张大图抠小图需要的信息
  	unsigned char* snapshot_image_data[MAX_OBJ_COUNT]{};
  	int snapshot_left[MAX_OBJ_COUNT]{};
  	int snapshot_right[MAX_OBJ_COUNT]{};
  	int snapshot_top[MAX_OBJ_COUNT]{};
  	int snapshot_bottom[MAX_OBJ_COUNT]{};
  	int snapshot_dst_width[MAX_OBJ_COUNT]{};
  	int snapshot_dst_height[MAX_OBJ_COUNT]{};
  
  	map<OBJ_KEY, OBJ_VALUE> total_snapshot_info;
  	map<OBJ_KEY, OBJ_VALUE> total_face_snapshot_info; //保存的人脸快照map
  
  
  	map<string, set<int>> algor_index_table;
  	task_param_manager *m_task_param_manager;
  
  public:
  	map<OBJ_KEY, OBJ_VALUE> *get_total_snapshot_info();
  	map<OBJ_KEY, OBJ_VALUE> *get_total_face_snapshot_info(); //返回保存的人脸快照map
  
  	void screen_effective_snapshot(const set<string> &taskid_inplay, vector<onelevel_det_result> &_onelevel_det_result);
  
  	bool snapshot_judge_algor(int index, int width, int height);
  	bool best_snapshot_judge_algor(const OBJ_KEY& obj_key, const OBJ_VALUE& obj_value, int left, int top, int width, int height, int image_width, int image_height);
  	bool best_face_snapshot_judge_algor(const OBJ_KEY& obj_key, const OBJ_VALUE& obj_value, int left, int top, int width, int height, int image_width, int image_height);
  	bool best_face_snapshot_judge_algor_v2(const OBJ_KEY& obj_key, const OBJ_VALUE& obj_value, int left, int top, int width, int height, int image_width, int image_height, float roll, float yaw, float pitch); //added by zsh 220719
  	void delete_finishtask_snapshot(const string taskid, const int objid = -1);   //-1为删除该路所有任务的快照图
  	/*
  	bool snapshot_legal_inarea(int width, int height);
  	bool snapshot_legal_minarea(int index, int width, int height);
  	bool snapshot_algor_open_config(const OBJ_KEY& obj_key);
  	bool snapshot_legal_pos(bitset<EDGESIZE> flags, int left, int top, int right, int bottom, int image_width, int image_height);
  	bool snapshot_legal_area(int max_area, int last_area, int left, int top, int right, int bottom);*/
  
  };