54 lines
1.7 KiB
C
54 lines
1.7 KiB
C
|
|
#ifndef KALMANBOXTRACKER_H
|
||
|
|
#define KALMANBOXTRACKER_H
|
||
|
|
#include "OCSortKalmanFilter.h"
|
||
|
|
#include "OCSortUtilities.h"
|
||
|
|
#include "iostream"
|
||
|
|
/*
|
||
|
|
This class represents the internal state of individual
|
||
|
|
tracked objects observed as bbox.
|
||
|
|
*/
|
||
|
|
namespace ANSOCSort {
|
||
|
|
class KalmanBoxTracker {
|
||
|
|
public:
|
||
|
|
/*method*/
|
||
|
|
KalmanBoxTracker() : kf(nullptr) {};
|
||
|
|
KalmanBoxTracker(Eigen::VectorXf bbox_,int delta_t_ = 3);
|
||
|
|
~KalmanBoxTracker();
|
||
|
|
|
||
|
|
// Deep copy (raw pointer ownership)
|
||
|
|
KalmanBoxTracker(const KalmanBoxTracker& other);
|
||
|
|
KalmanBoxTracker& operator=(const KalmanBoxTracker& other);
|
||
|
|
|
||
|
|
// Move semantics
|
||
|
|
KalmanBoxTracker(KalmanBoxTracker&& other) noexcept;
|
||
|
|
KalmanBoxTracker& operator=(KalmanBoxTracker&& other) noexcept;
|
||
|
|
|
||
|
|
void update(Eigen::Matrix<float, 9, 1>* bbox_);
|
||
|
|
Eigen::RowVectorXf predict();
|
||
|
|
Eigen::VectorXf get_state();
|
||
|
|
|
||
|
|
public:
|
||
|
|
/*variable*/
|
||
|
|
static int count;
|
||
|
|
Eigen::VectorXf bbox;// [9,1]
|
||
|
|
KalmanFilterNew* kf;
|
||
|
|
int time_since_update;
|
||
|
|
int id;
|
||
|
|
std::vector<Eigen::VectorXf> history;
|
||
|
|
int hits;
|
||
|
|
int hit_streak;
|
||
|
|
int age = 0;
|
||
|
|
Eigen::RowVectorXf last_observation = Eigen::RowVectorXf::Zero(9);
|
||
|
|
std::unordered_map<int, Eigen::VectorXf> observations;
|
||
|
|
std::vector<Eigen::VectorXf> history_observations;
|
||
|
|
Eigen::RowVectorXf velocity = Eigen::RowVectorXf::Zero(2);// [2,1]
|
||
|
|
int delta_t;
|
||
|
|
double GetScore() { return bbox[4]; }
|
||
|
|
int GetClassId() { return (int)bbox[5]; }
|
||
|
|
int GetDGId() { return (int)bbox[6]; }
|
||
|
|
int GetCamId() { return (int)bbox[7]; }
|
||
|
|
int GetModelId() { return (int)bbox[8]; }
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif
|