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

Method updateDetectedTracks

tracking/src/tracker3d.cpp:369–428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 12

getWorldCentroidMethod · 0.80
getHeightMethod · 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