| 89 | } |
| 90 | |
| 91 | void |
| 92 | TrackerObject::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 | |
| 145 | void |
| 146 | TrackerObject::updateTracks() |
nothing calls this directly
no test coverage detected