Blame view

src/MSRegionSurveilance/sort/KalmanBoxTracker.h 1.1 KB
8805b950   Liu Meng   物品遗留效果优化
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
  #ifndef KALMANBOXTRACKER_H_
  #define KALMANBOXTRACKER_H_
  
  #include <opencv2/video/tracking.hpp>
  #include <highgui.h>
  #include <iostream>
  #include <stdio.h>
  #include <math.h>
  #include <vector>
  #include "CycleQueue.h"
  
  using namespace std;
  
  #define FusionInterval 1 //控制算法跳帧
  class KalmanBoxTracker
  {
  public:
  	//int count = 0;
  	int time_since_update = 0;
  	int id = 0;
  	int cls = 0;
  	float score = 0.00;
  	//vector< vector<float> > history;
  
  	cycleQueue history;   //固定大小的轨迹
  
  	//int hits;
  	int hit_streak = 0;
  	int age = 0;
  	int m_trackLength = 0;
  
  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);
  void convert_bbox_to_z(vector<float> &bbox, vector<float> &z);
  void convert_x_to_bbox(cv::Mat &x, vector<float> &bbox);
  
  
  #endif