-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSortTrack.h
More file actions
52 lines (44 loc) · 1.03 KB
/
SortTrack.h
File metadata and controls
52 lines (44 loc) · 1.03 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
#pragma once
#include <Eigen/Dense>
#include "metadata.h"
#include "KalmanFilter.h"
namespace tracker
{
#define NUM_STATE 7
#define NUM_MESUAREMENTS 4
inline Eigen::VectorXd convertDet2VectorXd(Detection& det)
{
Eigen::VectorXd x(NUM_STATE);
float s = det.bbox.get_w() * det.bbox.get_h();
float r = det.bbox.get_w() / det.bbox.get_h();
x << det.bbox.xcenter(), det.bbox.ycenter(), s, r;
return x;
}
inline Detection convertVectorXdtoDetection(Eigen::VectorXd& x)
{
float w = std::sqrt(x[2] * x[3]);
float h = x[2] / w;
Detection det;
det.bbox.x1 = x[0] - w / 2;
det.bbox.y1 = x[1] - h / 2;
det.bbox.x2 = x[0] + w / 2;
det.bbox.y2 = x[1] + h / 2;
return det;
}
class SortTrack
{
public:
SortTrack(Detection det);
void update(Detection det);
Detection predict();
Detection getStateDetection();
int id;
int age;
int hits;
int hit_streak;
float time_since_update;
std::list<Detection> det_history;
KalmanFilter kf;
static int count;
};
}