Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi, I think your problem is the wrong usage of Point2f kalmanCorrect(float x, float y). You use the predicted state of the Kalman Filter to correct the filter.

p = kalmanPredict();
s = kalmanCorrect(p.x,p.y);

The state vector contains the 2D position and 2D velocity. In void initKalman(float x, float y) the position is set to x0 and y0 and the velocity in x and y direction is set to 0. If you then run kalmanPredict() the Kalman filter state will not change, since the velocity is 0. So you have after the kalmanPredict() still the state vector [x0, y0, 0, 0]. Then you run the correction step with the predicted position of the person (s = kalmanCorrect(p.x, p.y)). Since the predicted position of the person is still x0,y0 and the measurements are also x0,y0 the values in the state vector will also not change.

The solution should be, to use in the correction step of the Kalman filter the position where the person was detected in the current frame.