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

Method newFrame

tracking/src/tracker_object.cpp:91–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 14

clearMethod · 0.80
getTimeMethod · 0.80
getSourceMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
getVisibilityMethod · 0.45
isValidatedMethod · 0.45
getIdMethod · 0.45
validateMethod · 0.45

Tested by

no test coverage detected