snapshot_reprocessing.h
2.78 KB
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
/*
* @Author: yangzilong
* @Date: 2021-12-17 20:27:57
* @Last Modified by: yangzilong
* @Email: yangzilong@objecteye.com
* @Description:
*/
#pragma once
#include "../ai_platform/det_obj_header.h"
#include <vector>
#include <string>
#include <map>
#include <bitset>
#include "../ai_platform/task_param_manager.h"
#include "../ai_platform/header.h"
#include "../util/vpc_util.h"
// #define EXPANSION_PROPORTION 0.1
#define EXPANSION_PROPORTION 0.25
#define FACE_EXPANSION_PROPORTION 0.5
#define IMG_CHANNELS 3
using namespace std;
class DeviceMemory;
typedef struct multi_obj_data_t{
long long id;
DeviceMemory *memPtr;
std::vector<video_object_info> objs;
string task_id;
} multi_obj_data_t;
struct OBJ_VALUE {
bool finishTracker; //轨迹结束可以保存了
int frameCount;
bool isupdate;
int lost;
vpc_img_info snapShot;
vpc_img_info snapShotLittle;
sy_rect obj_pos;
double confidence; // 置信度
float last_area;
float max_area;
OBJ_INDEX index;
bitset< EDGESIZE > flags; //标志位,标记快照框应该如何判断,left:0 top:1 right:2 bottom:3
sy_point landmark_point[25];//人脸关键点位置信息
sy_rect position; //检测实际目标框
//-added by zsh 220719 人脸姿态角-
float roll = 0.0;
float yaw = 0.0;
float pitch = 0.0;
//-------------------------------
};
class snapshot_reprocessing
{
public:
//更新最优快照
snapshot_reprocessing(int devId);
~snapshot_reprocessing();
vector<multi_obj_data_t> get_vehicle_snapshot(vector<DeviceMemory*> vec_devMem, vector<onelevel_det_result>& ol_det_result, int skip_frame);
void screen_effective_snapshot(vector<onelevel_det_result> &_onelevel_det_result);
void filter_vehicle(vector<onelevel_det_result> &_onelevel_det_result);
void update_bestsnapshot(vector<DeviceMemory*> vec_devMem, vector<onelevel_det_result> &ol_det_result, vector<vector<int>>& delete_object_id);
map<OBJ_KEY, OBJ_VALUE> get_total_snapshot_info();
int update_face_bestsnapshot(vector<DeviceMemory*> vec_devMem, vector<onelevel_det_result> &ol_det_result, vector<vector<int>>& delete_object_id);
map<OBJ_KEY, OBJ_VALUE> get_total_face_snapshot_info();
void release_finished_locus_snapshot(const string taskid, const int obj_id, bool bRelease);
private:
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_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);
private:
map<OBJ_KEY, OBJ_VALUE> total_snapshot_info;
map<OBJ_KEY, OBJ_VALUE> total_face_snapshot_info;
map<string, set<int>> algor_index_table;
task_param_manager *m_task_param_manager;
};