1

I applied kalman filter where I lost the position of object while tracking. I have taken velocity model of kalman implementation (x,y,vx,vy).when detected object is lost in the frame, kalman prediction is started but it's predicting in random direction with high change in state(predicted box is not covering body part of object). What could be the reason for this?

Note: My detected box is random(at different part of body of object in random size ) as I'm using optical flow.

Using this I implemented the code for object tracking. But I took kalman-velocity model using this reference. While calculating velocity I took pixel change (centroid of object location) over processing frame difference (here not taking time due to some uncertainty in my case) assigning it to state vector and passing it to measurement with detected object centroid location (x,y) I tried to tune the parameter of kalman (eg: processNoiseCovariance = 1e-5 and measurementNoiseCovariance = 1e-1) init value but still not getting proper result. Can anyone suggest these value with explanation?

Second thing...how to handle the case when object is turning that time how can I use kalman for tracking because it's not working in this condition.

Any suggestion will be appreciated. Thanks in advance, :)

  • 1
    You explained your approach but you didnt share your codes. Can you share the code. – Yunus Temurlenk Jan 20 '20 at 06:41
  • For tracking you might want to use a IMM (interactive multiple model) which uses kalman filters for different movements (straight line constant speed, turn, acceleration, ...). If you only need a straight light at constant velocity, 1 kalman filter should be ok and no IMM would be needed. – mfnx Jan 20 '20 at 08:46
  • @YunusTemurlenk, sorry but I can't share the code.I have restrictions. – eLtronicsvilla Jan 20 '20 at 09:08
  • @mfnx, thanks for the info. In my case I have to use IMM as per your suggestion. – eLtronicsvilla Jan 20 '20 at 09:10
  • @Brijesh Well, it's too difficult to answer your question without having more info. Tracking is complex, and only tuning a kalman filter is a very broad topic. Start with one kalman filter and simple input data. Kalman straight line const velocity for instance. Make sure you get the Q matrix right as well as the input to the kalman filter. – mfnx Jan 20 '20 at 09:17
  • I updated the link above for the reference code I'm using here.This is straight line const velocity model.This example of ball tracking is working fine for me.But when applied the changes in my code , I'm getting random change in state due to changes in velocity (pixel difference per number of frame). I read [here](https://stackoverflow.com/questions/27296749/c-opencv-kalman-filter-for-video-stabilization) that 'processNoiseCovariance' is one of the dependent parameter for this output. Can you please explain it in my case and the value for it? – eLtronicsvilla Jan 21 '20 at 06:12
  • @mfnx, could you please suggest , if my velocity is not constant, by adjusting Q (processnoisecov) and R (measurementnoisecov) will it be helpful to reduce the randomness in predict. If not then for dynamic velocity how can I model my kalman? – eLtronicsvilla Jan 24 '20 at 09:24
  • @Brijesh The measurement noise is as it is, you don't "adjust" it. The process noise depends on the model you use for the kalman filter. If you use a constant velocity model, you should account for acceleration in your process noise. If you account for acceleration in your model, you may want to account for max high jerk in your Q (derivative of acceleration with time). It's like a taylor expansion. – mfnx Jan 24 '20 at 10:59
  • @mfnx,thanks a bunch.I was trying as per [this](https://stackoverflow.com/questions/21245167/kalman-filter-in-computer-vision-the-choice-of-q-and-r-noise-covariances).One quick question, for calculating Q , may I have to take derivative of complete state equation? Can you please suggest some link to get clarification on calculating and tuning Q value. I read [this](https://www.intechopen.com/books/kalman-filters-theory-for-advanced-applications/kalman-filter-for-moving-object-tracking-performance-analysis-and-filter-design) but the Q calculation I didn't understand. – eLtronicsvilla Jan 24 '20 at 15:09
  • better post the question on a math exchange – mfnx Jan 24 '20 at 15:44
  • @mfnx, thanks for all support. I find [here](http://www.robots.ox.ac.uk/~ian/Teaching/Estimation/LectureNotes2.pdf) the explanation to calculate Q matrix for kalman velocity model. – eLtronicsvilla Jan 28 '20 at 14:59

0 Answers0