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

Method updateDetectedTracks

tracking/src/tracker.cpp:385–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383}
384
385void
386Tracker::updateDetectedTracks()
387{
388 // std::cout << "Munkres output matrix:" << std::endl;
389 // for(int row = 0; row < cost_matrix_.rows; row++) {
390 // for(int col = 0; col < cost_matrix_.cols; col++) {
391 // std::cout.width(1);
392 // std::cout << cost_matrix_(row,col) << ",";
393 // }
394 // std::cout << std::endl;
395 // }
396 // std::cout << std::endl;
397
398 // Iterate over every track:
399 int track = 0;
400 for(std::list<open_ptrack::tracking::Track*>::iterator it = tracks_.begin(); it != tracks_.end(); it++)
401 {
402 bool updated = false;
403 open_ptrack::tracking::Track* t = *it;
404
405 for(int measure = 0; measure < cost_matrix_.cols; measure++)
406 {
407 // If a detection<->track association has been found:
408 if(cost_matrix_(track, measure) == 0.0 && distance_matrix_(track, measure) <= gate_distance_)
409 {
410 open_ptrack::detection::Detection& d = detections_[measure];
411
412 // If the detection has enough confidence in the current frame or in a recent past:
413 // if ((t->getLowConfidenceConsecutiveFrames() < 10) || ((d.getConfidence() - 0.5) > min_confidence_detections_))
414 if ((t->getLowConfidenceConsecutiveFrames() < 10) || (d.getConfidence() > ((min_confidence_ + min_confidence_detections_)/2)))
415 {
416 // Update track with the associated detection:
417 bool first_update = false;
418 associations_[measure] = t;
419 t->update(d.getWorldCentroid()(0), d.getWorldCentroid()(1), d.getWorldCentroid()(2),d.getWorldCentroid()(2),
420 d.getDistance(), distance_matrix_(track, measure),
421 d.getConfidence(), min_confidence_, min_confidence_detections_,
422 d.getSource(), first_update);
423
424 t->setVisibility(d.isOccluded() ? Track::OCCLUDED : Track::VISIBLE);
425 updated = true;
426 break;
427 }
428 else
429 {
430 //std::cout << "Id: " << t->getId() << ", lowConfConsFrames: " << t->getLowConfidenceConsecutiveFrames() << ", newConf: " << d.getConfidence()<< std::endl;
431 }
432 }
433 }
434 if(!updated)
435 {
436 if(t->getVisibility() != Track::NOT_VISIBLE)
437 {
438 t->setVisibility(Track::NOT_VISIBLE);
439 //t->update();
440 }
441 }
442 track++;

Callers

nothing calls this directly

Calls 11

getWorldCentroidMethod · 0.80
getSourceMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
getConfidenceMethod · 0.45
updateMethod · 0.45
getDistanceMethod · 0.45
setVisibilityMethod · 0.45
isOccludedMethod · 0.45
getVisibilityMethod · 0.45

Tested by

no test coverage detected