@@ -419,35 +419,33 @@ void MultiObjectTracker::sanitizeTracker(
419
419
const auto iou = object_recognition_utils::get2dIoU (object1, object2, min_union_iou_area);
420
420
const auto & label1 = sorted_list_tracker[i]->getHighestProbLabel ();
421
421
const auto & label2 = sorted_list_tracker[j]->getHighestProbLabel ();
422
- bool should_delete_tracker2 = false ;
422
+ bool delete_candidate_tracker = false ;
423
423
424
424
// If at least one of them is UNKNOWN, delete the one with lower IOU. Because the UNKNOWN
425
425
// objects are not reliable.
426
426
if (label1 == Label::UNKNOWN || label2 == Label::UNKNOWN) {
427
427
if (min_iou_for_unknown_object < iou) {
428
428
if (label2 == Label::UNKNOWN) {
429
- /* erase only when prioritized one has a measurement or the other one doesn't */
430
- if (sorted_list_tracker[i]->getNoMeasurementCount () <= 0 or
431
- sorted_list_tracker[j]->getNoMeasurementCount () > 0 ) {
432
- should_delete_tracker2 = true ;
433
- }
429
+ delete_candidate_tracker = true ;
434
430
}
435
431
}
436
432
} else { // If neither is UNKNOWN, delete the one with lower IOU.
437
433
if (min_iou < iou) {
438
434
/* erase only when prioritized one has a measurement */
439
- if (sorted_list_tracker[i]->getNoMeasurementCount () <= 0 ) {
440
- should_delete_tracker2 = true ;
441
- }
435
+ delete_candidate_tracker = true ;
442
436
}
443
437
}
444
438
445
- if (should_delete_tracker2) {
446
- // Remove from original list_tracker
447
- list_tracker.remove (sorted_list_tracker[j]);
448
- // Remove from sorted list
449
- sorted_list_tracker.erase (sorted_list_tracker.begin () + j);
450
- --j;
439
+ if (delete_candidate_tracker) {
440
+ /* erase only when prioritized one has a measurement or the other one doesn't */
441
+ if (sorted_list_tracker[i]->getNoMeasurementCount () <= 0 or
442
+ sorted_list_tracker[j]->getNoMeasurementCount () > 0 ) {
443
+ // Remove from original list_tracker
444
+ list_tracker.remove (sorted_list_tracker[j]);
445
+ // Remove from sorted list
446
+ sorted_list_tracker.erase (sorted_list_tracker.begin () + j);
447
+ --j;
448
+ }
451
449
}
452
450
}
453
451
}
0 commit comments