@@ -55,7 +55,7 @@ void CTracker::Update(const std::vector<Point_t>& detections)
5555 {
5656 for (size_t j = 0 ; j < detections.size (); j++)
5757 {
58- Point_t diff = ( tracks[i]->prediction - detections[j]) ;
58+ Point_t diff = tracks[i]->prediction - detections[j];
5959 track_t dist = sqrtf (diff.x *diff.x + diff.y *diff.y );
6060 Cost[i + j * N] = dist;
6161 }
@@ -117,25 +117,15 @@ void CTracker::Update(const std::vector<Point_t>& detections)
117117 {
118118 // If track updated less than one time, than filter state is not correct.
119119
120- tracks[i]->KF .GetPrediction ();
121-
122120 if (assignment[i] != -1 ) // If we have assigned detect, then update using its coordinates,
123121 {
124122 tracks[i]->skipped_frames = 0 ;
125- tracks[i]->prediction = tracks[i]-> KF . Update (detections[assignment[i]], 1 );
123+ tracks[i]->Update (detections[assignment[i]], true , max_trace_length );
126124 }
127- else // if not continue using predictions
125+ else // if not continue using predictions
128126 {
129- tracks[i]->prediction = tracks[i]-> KF . Update (Point_t (0 , 0 ), 0 );
127+ tracks[i]->Update (Point_t (0 , 0 ), false , max_trace_length );
130128 }
131-
132- if (tracks[i]->trace .size () > max_trace_length)
133- {
134- tracks[i]->trace .erase (tracks[i]->trace .begin (), tracks[i]->trace .end () - max_trace_length);
135- }
136-
137- tracks[i]->trace .push_back (tracks[i]->prediction );
138- tracks[i]->KF .LastResult = tracks[i]->prediction ;
139129 }
140130
141131}
0 commit comments