Blame view

vpt/src/VPT_timeout/sort/KalmanBoxTracker.h 1.19 KB
144cd8c4   Hu Chunming   v6.0.0 替换模型
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
  #ifndef KALMANBOXTRACKER_H_

  #define KALMANBOXTRACKER_H_

  

  #include <opencv2/video/tracking.hpp>

  #include <highgui.h>

  #include <iostream>

  #include <stdio.h>

  #include <math.h>

  #include <vector>

  

  using namespace std;

  using namespace cv;

  

  #define FusionInterval 1

  class KalmanBoxTracker

  {

  public:

  	//int count = 0;

  	int time_since_update;

  	int id;

  	int cls;

  	int counts;  //统计类别出现的次数

  	float score;

  	//vector< vector<float> > history;

  

  	vector<Point> trackLine;

  	//int hits;

  	int hit_streak;

  	int age;

  	bool istraffic;

  

  	int TrackerTimes; //记录该轨迹最近有几帧是跟踪预测算来的,如果跟踪预测多于一定数目,可以删除。

  

  public:

  	KalmanBoxTracker(vector<float> &bbox);

  	void update(vector<float> &bbox);

  	vector<float> predict();

  	vector<float> get_state();

  

  	void updateTrackLine(int center_x, int center_y);

  

  private:

  	KalmanFilter KF; //创建卡尔曼滤波器对象KF

  	Mat measurement;

  	Mat state;// (7, 1, CV_32F);                                     //state = x

  	Mat processNoise;

  };

  

  float IoU(vector<float> &bb_test, vector<float> &bb_gt);

  void convert_bbox_to_z(vector<float> &bbox, vector<float> &z);

  void convert_x_to_bbox(Mat &x, vector<float> &bbox);

  

  

  #endif