I'm doing vehicles tracking project. The video is a one-way, no vehicles occlusion. After doing background subtraction, erosion and dilation, I get bounding box objects for each frame, and I can find $centroid(c_x,c_y)$ from that. So, the next thing I want to do is blobs tracking. Here is what I'm thinking on how to do the blobs tracking:

  1. At first frame, store all (cx,cy,id)
  2. Next frame, calculate distance each new (cx,cy) with each of old (cx,cy)
  3. If distance < threshold, update the old (cx,cy) which qualify the formula
  4. If distance > threshold, check if the cx,cy is near the entry coordinate (e.g. around x,y=0-640,0-40), if yes store new (cx,cy).

Is it right and possible to apply to tracking?

  • $\begingroup$ Looks good. Suggested alternative technique in answer. $\endgroup$ Jan 18, 2015 at 2:02
  • $\begingroup$ What if the number of centroids increase or decrease? $\endgroup$ Jan 5, 2017 at 22:03

1 Answer 1


You might want to consider tracking using MeanShift & Cam Shift:


  • $\begingroup$ Isn't makeshift and camshift is for single tracking, how I can use the technique for vehicles? $\endgroup$ Jan 18, 2015 at 10:20
  • $\begingroup$ Can you elaborate on what you mean by 'single tracking'? The example in the link uses Meanshift and CamShift Techniques for vehicle tracking which I believe is your objective. $\endgroup$ Jan 18, 2015 at 20:10
  • $\begingroup$ I'm sorry, I'm wrong.. I read some paper and it can tracking multiple objects.. But I'm still don't understand how to do it.. I'm confuse with the mathematics terms.. $\endgroup$ Jan 19, 2015 at 5:09
  • $\begingroup$ It sounds good, but how do you get the bounding boxes? $\endgroup$
    – user20881
    May 6, 2016 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.