3 using namespace suanzi;
6 static const int MaxLost = 5;
8 Tracker::Tracker(int id) : id(id)
10 status = TrackerStatus::Fire;
11 preStatus = TrackerStatus::Fire;
18 void Tracker::addPatch(Patch* p)
21 if (patches.size() > Metrics::MaxPatch){
22 patches.erase(patches.end());
26 void Tracker::updateState(const Mat& image)
28 preStatus = this->status;
29 int lost_age = this->age - this->last_active;
30 int active_age = this->last_active;
32 if (lost_age >= MaxLost){
33 status = TrackerStatus::Delete;
34 } else if (lost_age >= 1 && active_age == 1){
35 status = TrackerStatus::Delete;
36 } else if (lost_age >= 1) {
37 status = TrackerStatus::Lost;