| 246 | } |
| 247 | |
| 248 | void |
| 249 | SkeletonTracker::updateDetectedTracks() |
| 250 | { |
| 251 | // Iterate over every track: |
| 252 | int track = 0; |
| 253 | for(std::list<open_ptrack::tracking::SkeletonTrack*>::iterator |
| 254 | it = tracks_.begin(), end = tracks_.end(); it != end; it++) |
| 255 | { |
| 256 | bool updated = false; |
| 257 | open_ptrack::tracking::SkeletonTrack* t = *it; |
| 258 | |
| 259 | for(int measure = 0; measure < cost_matrix_.cols; measure++) |
| 260 | { |
| 261 | // If a detection<->track association has been found: |
| 262 | if(cost_matrix_(track, measure) == 0.0 && |
| 263 | distance_matrix_(track, measure) <= gate_distance_) |
| 264 | { |
| 265 | open_ptrack::detection::SkeletonDetection& d = detections_[measure]; |
| 266 | |
| 267 | // If the detection has enough confidence in the current |
| 268 | // frame or in a recent past: |
| 269 | if ((t->getLowConfidenceConsecutiveFrames() < 10) |
| 270 | or (d.getConfidence() > |
| 271 | ((min_confidence_ + min_confidence_detections_)/2))) |
| 272 | { |
| 273 | // Update track with the associated detection: |
| 274 | bool first_update = false; |
| 275 | t->update(d.getWorldCentroid()(0), |
| 276 | d.getWorldCentroid()(1), |
| 277 | d.getWorldCentroid()(2), |
| 278 | d.getHeight(), |
| 279 | d.getDistance(), distance_matrix_(track, measure), |
| 280 | d.getConfidence(), min_confidence_, |
| 281 | min_confidence_detections_, |
| 282 | d.getSource(), d.getSkeletonMsg().joints, |
| 283 | first_update |
| 284 | ); |
| 285 | |
| 286 | t->setVisibility(d.isOccluded() ? SkeletonTrack::OCCLUDED : |
| 287 | SkeletonTrack::VISIBLE); |
| 288 | updated = true; |
| 289 | break; |
| 290 | } |
| 291 | } |
| 292 | } |
| 293 | if(!updated) |
| 294 | { |
| 295 | if(t->getVisibility() != SkeletonTrack::NOT_VISIBLE) |
| 296 | { |
| 297 | t->setVisibility(SkeletonTrack::NOT_VISIBLE); |
| 298 | } |
| 299 | } |
| 300 | track++; |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | void |
| 305 | SkeletonTracker::createNewTracks() |
nothing calls this directly
no test coverage detected