public void associateAllToDetected ( ) { // initialize data structures List < CombinedTrack < TD >> all = new ArrayList <> ( ) ; all . addAll ( tracksReactivated ) ; all . addAll ( tracksDormant ) ; all . addAll ( tracksPureKlt ) ; int numTainted = tracksReactivated . size ( ) + tracksDormant . size ( ) ; tracksReactivated . clear ( ) ; tracksDormant . clear ( ) ; // detect features detector . detect ( input ) ; // associate features associateToDetected ( all ) ; FastQueue < AssociatedIndex > matches = associate . getMatches ( ) ; // See which features got respawned and which ones are made dormant for ( int i = 0 ; i < numTainted ; i ++ ) { associated [ i ] = false ; } for ( AssociatedIndex a : matches . toList ( ) ) { // don't mess with pure-KLT tracks if ( a . src >= numTainted ) continue ; CombinedTrack < TD > t = all . get ( a . src ) ; t . set ( detector . getLocation ( a . dst ) ) ; trackerKlt . setDescription ( ( float ) t . x , ( float ) t . y , t . track ) ; tracksReactivated . add ( t ) ; associated [ a . src ] = true ; } for ( int i = 0 ; i < numTainted ; i ++ ) { if ( ! associated [ i ] ) { tracksDormant . add ( all . get ( i ) ) ; } } }
Associate all tracks in any state to the latest observations . If a dormant track is associated it will be reactivated . If a reactivated track is associated it s state will be updated . PureKLT tracks are left unmodified .