Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Multi-tracking Kalman Filter Problem

I am attempting to perform a multi-tracking by means Kalman filter algorithm. I declared it as

KalmanFilter kf[2]

The problem is that when I update the filter, or I use statePost function like here

for(index=0;index<2;index++)
  kf[index].statePost = state[index];

where state variable is different for each kf tracked object, the algorithm updates BOTH kf[0] and kf[1] with the same value, actually the last one,state[1], and therefore I lose track of the first object I track. Indeed if I call

kf[0].statePost.at<float>(0)
kf[1].statePost.at<float>(0)

The result is the same!! How it is possible? They are two different c++ objects! I'm sure the indexing is correct!

Multi-tracking Kalman Filter Problem

I am attempting to perform a multi-tracking by means Kalman filter algorithm. I declared it as

KalmanFilter kf[2]

and I initialized it as

for(int i=0; i<kalNum; i++){ 
  kf[i].init(stateSize, measSize, contrSize, type); . . .

The problem is that when I update the filter, or I use statePost function like here

for(index=0;index<2;index++)
  kf[index].statePost = state[index];

where state variable is different for each kf tracked object, the algorithm updates BOTH kf[0] and kf[1] with the same value, actually the last one,state[1], and therefore I lose track of the first object I track. Indeed if I call

kf[0].statePost.at<float>(0)
kf[1].statePost.at<float>(0)

The result is the same!! How it is possible? They are two different c++ objects! I'm sure the indexing is correct!