Search code examples
opencvcomputer-visionkalman-filter

Arguments of the Kalman Filter in OpenCV


We have been trying to use Kalman filter to improve our trajectory prediction code. I have looked at some online resources and understood most of the part of how it is used in opencv but what I am unable to understand is the constructor call to KalmanFilter in OpenCV.

KalmanFilter KF(2, 1, 0);

What do 2, 1 and 0 here represent?

Update: Finally figured out the meaning of the arguments by printing or the sizes of the various matrices involved.

State: 2x1

State transition matrix: 2x2

Control matrix: 0x0


Solution

  • As described by the documentation, the 2,1, and 0 are the dimensionalities of the state, measurements, and control spaces.

    That is, your state vector has length 2, measurements are scalars, and there is no control signal.