MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / newFrame

Method newFrame

tracking/src/tracker.cpp:91–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void
92Tracker::newFrame(const std::vector<open_ptrack::detection::Detection>& detections)
93{
94 detections_.clear();
95 unassociated_detections_.clear();
96 lost_tracks_.clear();
97 new_tracks_.clear();
98 associations_.assign(detections.size(), NULL);
99 detections_ = detections;
100
101 ros::Time current_detections_time = detections_[0].getSource()->getTime();
102
103 for(std::list<open_ptrack::tracking::Track*>::iterator it = tracks_.begin(); it != tracks_.end();)
104 {
105 open_ptrack::tracking::Track* t = *it;
106 bool deleted = false;
107
108 if(((t->getVisibility() == Track::NOT_VISIBLE && (t->getSecFromLastHighConfidenceDetection(current_detections_time)) >= sec_before_old_)
109 || (!t->isValidated() && t->getSecFromFirstDetection(current_detections_time) >= sec_before_fake_)))
110 {
111 if (debug_mode_)
112 {
113 std::cout << "Track " << t->getId() << " DELETED" << std::endl;
114 }
115 delete t;
116 it = tracks_.erase(it);
117 deleted = true;
118 }
119 else if(!t->isValidated() && t->getUpdatesWithEnoughConfidence() == detections_to_validate_)
120 {
121 t->validate();
122 if (debug_mode_)
123 {
124 std::cout << "Track " << t->getId() << " VALIDATED" << std::endl;
125 }
126 }
127 else if(t->getStatus() == Track::NEW && t->getSecFromFirstDetection(current_detections_time) >= sec_remain_new_)
128 {
129 t->setStatus(Track::NORMAL);
130 if (debug_mode_)
131 {
132 std::cout << "Track " << t->getId() << " set to NORMAL" << std::endl;
133 }
134 }
135
136 if(!deleted)
137 {
138 if(t->getStatus() == Track::NEW && t->getVisibility() == Track::VISIBLE)
139 new_tracks_.push_back(t);
140 if(t->getVisibility() == Track::NOT_VISIBLE)
141 lost_tracks_.push_back(t);
142 it++;
143 }
144
145 }
146}
147
148void

Callers 4

detection_cbFunction · 0.45
detection_cbFunction · 0.45
detection_cbFunction · 0.45
detection_cbFunction · 0.45

Calls 15

clearMethod · 0.80
assignMethod · 0.80
getTimeMethod · 0.80
getSourceMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getVisibilityMethod · 0.45
isValidatedMethod · 0.45
getIdMethod · 0.45

Tested by

no test coverage detected