opencv on mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

KalmanFilter Class Reference

KalmanFilter Class Reference
[Object Tracking]

Kalman filter class. More...

#include <tracking.hpp>

Public Member Functions

CV_WRAP KalmanFilter ()
 The constructors.
CV_WRAP KalmanFilter (int dynamParams, int measureParams, int controlParams=0, int type=CV_32F)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void init (int dynamParams, int measureParams, int controlParams=0, int type=CV_32F)
 Re-initializes Kalman filter.
CV_WRAP const Matpredict (const Mat &control=Mat())
 Computes a predicted state.
CV_WRAP const Matcorrect (const Mat &measurement)
 Updates the predicted state from the measurement.

Data Fields

CV_PROP_RW Mat statePre
 predicted state (x'(k)): x(k)=A*x(k-1)+B*u(k)
CV_PROP_RW Mat statePost
 corrected state (x(k)): x(k)=x'(k)+K(k)*(z(k)-H*x'(k))
CV_PROP_RW Mat transitionMatrix
 state transition matrix (A)
CV_PROP_RW Mat controlMatrix
 control matrix (B) (not used if there is no control)
CV_PROP_RW Mat measurementMatrix
 measurement matrix (H)
CV_PROP_RW Mat processNoiseCov
 process noise covariance matrix (Q)
CV_PROP_RW Mat measurementNoiseCov
 measurement noise covariance matrix (R)
CV_PROP_RW Mat errorCovPre
 priori error estimate covariance matrix (P'(k)): P'(k)=A*P(k-1)*At + Q)*/
CV_PROP_RW Mat gain
 Kalman gain matrix (K(k)): K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)
CV_PROP_RW Mat errorCovPost
 posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P'(k)

Detailed Description

Kalman filter class.

The class implements a standard Kalman filter <http://en.wikipedia.org/wiki/Kalman_filter>, Welch95 . However, you can modify transitionMatrix, controlMatrix, and measurementMatrix to get an extended Kalman filter functionality. See the OpenCV sample kalman.cpp.

Note:
  • An example using the standard Kalman filter can be found at opencv_source_code/samples/cpp/kalman.cpp

Definition at line 327 of file tracking.hpp.


Constructor & Destructor Documentation

CV_WRAP KalmanFilter (  )

The constructors.

Note:
In C API when CvKalman\* kalmanFilter structure is not needed anymore, it should be released with cvReleaseKalman(&kalmanFilter)
CV_WRAP KalmanFilter ( int  dynamParams,
int  measureParams,
int  controlParams = 0,
int  type = CV_32F 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
dynamParamsDimensionality of the state.
measureParamsDimensionality of the measurement.
controlParamsDimensionality of the control vector.
typeType of the created matrices that should be CV_32F or CV_64F.

Member Function Documentation

CV_WRAP const Mat& correct ( const Mat measurement )

Updates the predicted state from the measurement.

Parameters:
measurementThe measured system parameters
void init ( int  dynamParams,
int  measureParams,
int  controlParams = 0,
int  type = CV_32F 
)

Re-initializes Kalman filter.

The previous content is destroyed.

Parameters:
dynamParamsDimensionality of the state.
measureParamsDimensionality of the measurement.
controlParamsDimensionality of the control vector.
typeType of the created matrices that should be CV_32F or CV_64F.
CV_WRAP const Mat& predict ( const Mat control = Mat() )

Computes a predicted state.

Parameters:
controlThe optional input control

Field Documentation

CV_PROP_RW Mat controlMatrix

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

Definition at line 368 of file tracking.hpp.

CV_PROP_RW Mat errorCovPost

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

Definition at line 374 of file tracking.hpp.

CV_PROP_RW Mat errorCovPre

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

Definition at line 372 of file tracking.hpp.

CV_PROP_RW Mat gain

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

Definition at line 373 of file tracking.hpp.

CV_PROP_RW Mat measurementMatrix

measurement matrix (H)

Definition at line 369 of file tracking.hpp.

measurement noise covariance matrix (R)

Definition at line 371 of file tracking.hpp.

CV_PROP_RW Mat processNoiseCov

process noise covariance matrix (Q)

Definition at line 370 of file tracking.hpp.

CV_PROP_RW Mat statePost

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

Definition at line 366 of file tracking.hpp.

CV_PROP_RW Mat statePre

predicted state (x'(k)): x(k)=A*x(k-1)+B*u(k)

Definition at line 365 of file tracking.hpp.

CV_PROP_RW Mat transitionMatrix

state transition matrix (A)

Definition at line 367 of file tracking.hpp.