3 using namespace suanzi;
6 static const int MaxLost = 5;
8 Tracker::Tracker(const cv::Mat& image,int id) : id(id)
10 status = TrackerStatus::Fire;
11 preStatus = TrackerStatus::Fire;
15 this->kf.transitionMatrix = (Mat_<float>(4, 4) <<
21 this->kf.measurementMatrix = (Mat_<float>(2, 2) <<
25 this->kf.processNoiseCov = 1e-5 * Mat_<float>::eye(4, 4);
26 this->kf.measurementNoiseCov = 1e-1 * Mat_<float>::ones(2, 2);
27 this->kf.errorCovPost = 1. * Mat_<float>::ones(4, 4);
37 void Tracker::updateState(const Mat& image)
39 preStatus = this->status;
40 int lost_age = this->age - this->last_active;
41 int active_age = this->last_active;
43 if (lost_age >= MaxLost){
44 status = TrackerStatus::Delete;
45 } else if (lost_age >= 1 && active_age == 1){
46 status = TrackerStatus::Delete;
47 } else if (lost_age >= 1) {
48 status = TrackerStatus::Lost;
52 void Tracker::addPatch(PatchPtr p)
54 this->patches.push_back(p);