implementation of a 2nd order linear Kalman Filter More...
#include <Image/KalmanFilter.H>
Public Member Functions | |
KalmanFilter () | |
default constructor - need to call init before the filter can be used | |
KalmanFilter (float initialM, float pNoise=DEF_PNOISE, float mNoise=DEF_MNOISE, float timeStep=DEF_TSTEP) | |
constructor that initializes the filter | |
void | init (float initialM, float pNoise=DEF_PNOISE, float mNoise=DEF_MNOISE, float timeStep=DEF_TSTEP) |
initialize the filter | |
void | writeToStream (std::ostream &os) const |
write the entire KalmanFilter to the output stream os | |
void | readFromStream (std::istream &is) |
read the KalmanFilter from the input stream is | |
float | getEstimate () const |
returns a prediction for the next value | |
float | getEstimate (float measurement) const |
returns a prediction for the next value given a measurement | |
float | getSpeed () const |
returns the speed (second entry in the state vector) | |
float | getCost (float measurement) const |
returns the cost for associating measurement with this Kalman tracker | |
float | update () |
update the filter for the next time step without a measurement (skipped value) | |
float | update (float measurement) |
update the filter for the next time step with a measurement | |
Image< float > | getStateVector () const |
returns the current state vector [x, v, a] | |
Image< float > | getCovariances () const |
returns the covariance matrix P | |
bool | isInitialized () const |
test whether the filter is initialized |
implementation of a 2nd order linear Kalman Filter
This class can be used for tracking. The state vector is second order, i.e. it maintains location, speed, and accelaration to generate predictions.
Definition at line 52 of file KalmanFilter.H.
KalmanFilter::KalmanFilter | ( | ) |
default constructor - need to call init before the filter can be used
Definition at line 54 of file KalmanFilter.C.
KalmanFilter::KalmanFilter | ( | float | initialM, | |
float | pNoise = DEF_PNOISE , |
|||
float | mNoise = DEF_MNOISE , |
|||
float | timeStep = DEF_TSTEP | |||
) |
constructor that initializes the filter
initialM | - the initial measurement used to jump start the filter | |
pNoise | - std of the (Gaussian) proess noise | |
mNoise | - std of the (Gaussian) measurement noise | |
timeStep | - the time interval between measurements (default: 1) |
Definition at line 59 of file KalmanFilter.C.
References init().
float KalmanFilter::getCost | ( | float | measurement | ) | const |
returns the cost for associating measurement with this Kalman tracker
Definition at line 230 of file KalmanFilter.C.
References ASSERT, getEstimate(), and writeToStream().
Referenced by VisualEvent::getCost().
Image< float > KalmanFilter::getCovariances | ( | ) | const |
float KalmanFilter::getEstimate | ( | float | measurement | ) | const |
returns a prediction for the next value given a measurement
Definition at line 214 of file KalmanFilter.C.
References ASSERT, and Image< T >::getVal().
float KalmanFilter::getEstimate | ( | ) | const |
returns a prediction for the next value
Definition at line 205 of file KalmanFilter.C.
References ASSERT, and Image< T >::getVal().
Referenced by VisualEvent::assign(), VisualEvent::getCost(), getCost(), and VisualEvent::predictedLocation().
float KalmanFilter::getSpeed | ( | ) | const |
returns the speed (second entry in the state vector)
Definition at line 223 of file KalmanFilter.C.
References ASSERT.
Image< float > KalmanFilter::getStateVector | ( | ) | const |
returns the current state vector [x, v, a]
Definition at line 278 of file KalmanFilter.C.
References ASSERT.
void KalmanFilter::init | ( | float | initialM, | |
float | pNoise = DEF_PNOISE , |
|||
float | mNoise = DEF_MNOISE , |
|||
float | timeStep = DEF_TSTEP | |||
) |
initialize the filter
initialM | - the initial measurement used to jump start the filter | |
pNoise | - std of the (Gaussian) process noise | |
mNoise | - std of the (Gaussian) measurement noise | |
timeStep | - the time interval between measurements (default: 1) |
Definition at line 68 of file KalmanFilter.C.
References NO_INIT, Image< T >::resize(), Image< T >::setVal(), transpose(), and ZEROS.
Referenced by KalmanFilter().
bool KalmanFilter::isInitialized | ( | void | ) | const |
test whether the filter is initialized
Definition at line 292 of file KalmanFilter.C.
void KalmanFilter::readFromStream | ( | std::istream & | is | ) |
read the KalmanFilter from the input stream is
Definition at line 168 of file KalmanFilter.C.
References readImageFromStream().
Referenced by VisualEvent::readFromStream().
float KalmanFilter::update | ( | float | measurement | ) |
update the filter for the next time step with a measurement
Definition at line 262 of file KalmanFilter.C.
References ASSERT, and writeToStream().
float KalmanFilter::update | ( | ) |
update the filter for the next time step without a measurement (skipped value)
Definition at line 246 of file KalmanFilter.C.
References ASSERT, and writeToStream().
Referenced by VisualEvent::assign().
void KalmanFilter::writeToStream | ( | std::ostream & | os | ) | const |
write the entire KalmanFilter to the output stream os
Definition at line 145 of file KalmanFilter.C.
References writeImageToStream().
Referenced by getCost(), update(), and VisualEvent::writeToStream().