Skip to content

Commit 6259c1e

Browse files
author
baudenri
committed
Expose Error Cross-Covariance in Uncented Kalman Filters
For some applications it is useful to have an estimate of how uncertain the specific variable is estimated. This could help to act accordingly e.g. increase the measurement zone if the current estimate is very uncertain.
1 parent 5e008c8 commit 6259c1e

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

modules/tracking/include/opencv2/tracking/kalman_filters.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ class CV_EXPORTS UnscentedKalmanFilter
8080
*/
8181
virtual Mat getMeasurementNoiseCov() const = 0;
8282

83+
/**
84+
* @return the error cross-covariance matrix.
85+
*/
86+
virtual Mat getErrorCov() const = 0;
87+
8388
/**
8489
* @return the current estimate of the state.
8590
*/

modules/tracking/src/augmented_unscented_kalman.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ class AugmentedUnscentedKalmanFilterImpl: public UnscentedKalmanFilter
195195

196196
Mat getProcessNoiseCov() const;
197197
Mat getMeasurementNoiseCov() const;
198+
Mat getErrorCov() const;
198199

199200
Mat getState() const;
200201

@@ -425,6 +426,11 @@ Mat AugmentedUnscentedKalmanFilterImpl::getMeasurementNoiseCov() const
425426
return measurementNoiseCov.clone();
426427
}
427428

429+
Mat AugmentedUnscentedKalmanFilterImpl::getErrorCov() const
430+
{
431+
return errorCov.clone();
432+
}
433+
428434
Mat AugmentedUnscentedKalmanFilterImpl::getState() const
429435
{
430436
return state.clone();

modules/tracking/src/unscented_kalman.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ class UnscentedKalmanFilterImpl: public UnscentedKalmanFilter
189189
// Get system parameters
190190
Mat getProcessNoiseCov() const;
191191
Mat getMeasurementNoiseCov() const;
192+
Mat getErrorCov() const;
192193

193194
// Get the state estimate
194195
Mat getState() const;
@@ -400,6 +401,11 @@ Mat UnscentedKalmanFilterImpl::getMeasurementNoiseCov() const
400401
return measurementNoiseCov.clone();
401402
}
402403

404+
Mat UnscentedKalmanFilterImpl::getErrorCov() const
405+
{
406+
return errorCov.clone();
407+
}
408+
403409
Mat UnscentedKalmanFilterImpl::getState() const
404410
{
405411
return state.clone();

0 commit comments

Comments
 (0)