common.h
2.76 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#ifndef COMMON_H_
#define COMMON_H_
#include <functional>
#include "header.h"
#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "MyAtomic.hpp"
#include "../FFNvDecoder/DxDecoderWrap.h"
#define IMG_CHANNELS 3
#define SCALE_OUT 10 //判断目标框初始位置时,在最小距离的基础上适当外扩
#define MAX_OBJ_COUNT 100
struct OBJ_KEY {
int videoID;
int objID;
bool operator< (OBJ_KEY const& _A) const
{
if (videoID < _A.videoID) return true;
if (videoID == _A.videoID) return objID < _A.objID;
return false;
}
bool operator== (OBJ_KEY const& _A) const
{
if (videoID == _A.videoID && objID == _A.objID)
return true;
else
return false;
}
};
struct FRAME_KEY {
int videoID;
unsigned int objID;
bool operator< (FRAME_KEY const& _A) const
{
if (videoID < _A.videoID) return true;
if (videoID == _A.videoID) return objID < _A.objID;
return false;
}
bool operator== (FRAME_KEY const& _A) const
{
if (videoID == _A.videoID && objID == _A.objID)
return true;
else
return false;
}
};
using SNAPSHOT_CALLBACK = std::function<void(video_object_snapshot *)>;
using REALTIME_CALLBACK = std::function<void(unsigned char *img_data, int img_height, int img_width)>;
using FINISH_CALLBACK = std::function<void( const int )>;
using OBJECT_INFO_CALLBACK = std::function<void(video_object_info *)>;
struct VideoHeightWidth{
double height;
double width;
};
enum TaskState
{
PLAY,
PAUSE,
FINISH,
DECODEERROR //解码线程可能报错,报错之后直接结束掉该路解码
};
struct Task{
int taskID;
const char *taskFileSource;
TaskState taskState;
DxDecoderWrap *taskTcuvid;
DxGPUFrame task_algorithm_data; //����¿�ܲ���resize�Ĵ���������ʱ��backup��ԭͼ��С��ͼƬ�ͽ��㷨�������
bool taskHasBackup;
VideoHeightWidth taskHeightWidth;
MyAtomic<int> taskFrameCount;
MyAtomic<int> taskLastFrameCount;
int taskTotalFrameCount;
SNAPSHOT_CALLBACK taskObjCallbackFunc;
REALTIME_CALLBACK taskRealTimeCallbackFunc;
cv::Mat frameImage;
char* folderNameLittle;
char* folderName;
char* folderNameFace;
sy_rect task_min_boxsize[DETECTTYPE];
};
typedef struct VPT_ObjInfo //����ṹ��
{
int left;
int top;
int right;
int bottom;
int center_x;
int center_y;
int index; // ����/�������֧��10��
long id; // Ŀ��ΨһID��ͬһIDΪͬһĿ��
int num; // ��ID�����µĵ�num֡
double confidence; // ���Ŷ�
int snap_flag;
}VPT_ObjInfo;
typedef struct VPT_Result
{
int objCount;
VPT_ObjInfo obj[MAX_OBJ_COUNT];
}VPT_Result;
#endif