KalmanBoxTracker.h
1.42 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
#ifndef KALMANBOXTRACKER_H_
#define KALMANBOXTRACKER_H_
#include <opencv2/opencv.hpp>
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <vector>
#include "CycleQueue.h"
using namespace std;
// #define FusionInterval 5 //控制算法跳帧
class KalmanBoxTracker
{
public:
//int count = 0;
int time_since_update = 0;
int FusionInterval = 5; //控制算法跳帧 221117
int id = 0;
int cls = 0;
float score = 0.00;
std::vector<float> ldmk;
//-added by zsh 220719 人脸姿态角-
float roll = 0.0;
float yaw = 0.0;
float pitch = 0.0;
//-------------------------------
//vector< vector<float> > history;
cycleQueue history; //固定大小的轨迹
//int hits;
int hit_streak = 0;
int age = 0;
int m_trackLength = 0;
int frame_count {1};
public:
KalmanBoxTracker(vector<float> &bbox, int trackLength);
~KalmanBoxTracker();
void update(vector<float> &bbox);
vector<float> predict();
vector<float> get_state();
private:
cv::KalmanFilter KF; //创建卡尔曼滤波器对象KF
cv::Mat measurement;
cv::Mat state;// (7, 1, CV_32F); //state = x
cv::Mat processNoise;
};
float IoU(vector<float> &bb_test, vector<float> &bb_gt);
float center_distance(vector<float> &bb_test, vector<float> &bb_gt, float maxLength); // added by zsh 220718
void convert_bbox_to_z(vector<float> &bbox, vector<float> &z);
void convert_x_to_bbox(cv::Mat &x, vector<float> &bbox);
#endif