let Kalman handle the missing measurements (bug #1380)

This commit is contained in:
Vadim Pisarevsky
2012-10-12 14:01:36 +04:00
parent 2abb67cc92
commit cb58e5a3a4
2 changed files with 8 additions and 1 deletions

View File

@@ -171,6 +171,9 @@ cvKalmanPredict( CvKalman* kalman, const CvMat* control )
/* P'(k) = temp1*At + Q */
cvGEMM( kalman->temp1, kalman->transition_matrix, 1, kalman->process_noise_cov, 1,
kalman->error_cov_pre, CV_GEMM_B_T );
/* handle the case when there will be measurement before the next predict */
cvCopy(kalman->state_pre, kalman->state_post);
return kalman->state_pre;
}
@@ -260,6 +263,9 @@ const Mat& KalmanFilter::predict(const Mat& control)
// P'(k) = temp1*At + Q
gemm(temp1, transitionMatrix, 1, processNoiseCov, 1, errorCovPre, GEMM_2_T);
// handle the case when there will be measurement before the next predict.
statePre.copyTo(statePost);
return statePre;
}