Table of Contents

Class KalmanFilter

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

Kalman filter. The class implements standard Kalman filter \url{http://en.wikipedia.org/wiki/Kalman_filter}. However, you can modify KalmanFilter::transitionMatrix, KalmanFilter::controlMatrix and KalmanFilter::measurementMatrix to get the extended Kalman filter functionality.

public class KalmanFilter : DisposableCvObject, IDisposable, ICvPtrHolder
Inheritance
KalmanFilter
Implements
Inherited Members

Constructors

KalmanFilter()

the default constructor

public KalmanFilter()

KalmanFilter(int, int, int, int)

the full constructor taking the dimensionality of the state, of the measurement and of the control vector

public KalmanFilter(int dynamParams, int measureParams, int controlParams = 0, int type = 5)

Parameters

dynamParams int
measureParams int
controlParams int
type int

Properties

ControlMatrix

control matrix (B) (not used if there is no control)

public Mat ControlMatrix { get; set; }

Property Value

Mat

ErrorCovPost

posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P'(k)

public Mat ErrorCovPost { get; set; }

Property Value

Mat

ErrorCovPre

priori error estimate covariance matrix (P'(k)): P'(k)=A*P(k-1)At + Q)/

public Mat ErrorCovPre { get; set; }

Property Value

Mat

Gain

Kalman gain matrix (K(k)): K(k)=P'(k)Htinv(H*P'(k)*Ht+R)

public Mat Gain { get; set; }

Property Value

Mat

MeasurementMatrix

measurement matrix (H)

public Mat MeasurementMatrix { get; set; }

Property Value

Mat

MeasurementNoiseCov

measurement noise covariance matrix (R)

public Mat MeasurementNoiseCov { get; set; }

Property Value

Mat

ProcessNoiseCov

process noise covariance matrix (Q)

public Mat ProcessNoiseCov { get; set; }

Property Value

Mat

StatePost

corrected state (x(k)): x(k)=x'(k)+K(k)(z(k)-Hx'(k))

public Mat StatePost { get; set; }

Property Value

Mat

StatePre

predicted state (x'(k)): x(k)=Ax(k-1)+Bu(k)

public Mat StatePre { get; set; }

Property Value

Mat

TransitionMatrix

state transition matrix (A)

public Mat TransitionMatrix { get; set; }

Property Value

Mat

Methods

Correct(Mat)

updates the predicted state from the measurement

public Mat Correct(Mat measurement)

Parameters

measurement Mat

Returns

Mat

DisposeUnmanaged()

Releases unmanaged resources

protected override void DisposeUnmanaged()

Init(int, int, int, int)

re-initializes Kalman filter. The previous content is destroyed.

public void Init(int dynamParams, int measureParams, int controlParams = 0, int type = 5)

Parameters

dynamParams int
measureParams int
controlParams int
type int

Predict(Mat?)

computes predicted state

public Mat Predict(Mat? control = null)

Parameters

control Mat

Returns

Mat