2

I'm working on a project and I really can't reach a solution. My goal is to track some circular objects of the same color (red) in a video. My current pipeline is:

  1. Convert each frame from BGR to HSV
  2. Threshold the image using inRange() function
  3. Some morph operations like erode(), dilate(), blur()
  4. Find contours and then some infos like area, centroid etc...
  5. Draw contours on the original frame
  6. Save the new centroid position in every frame (in a python dictionary)

The problems are:

  1. The result is a little noisy
  2. I can't give an identity to each object (there are problems when two object come in contact, or when an object disappears and then reappears etc...)

I would be grateful if someone has some suggestions on what's the best way to procees and how can I change pipeline (e.g. using Kalman Filter, Camshift or other algorithms). I'm not a CV expert, so please be patient. Thanks a lot

--EDIT--

The objects are moving slow, and the tracking will be referred to long periods (even hours).

The main question is: how can I "see" these slow, circular objects and insert them in a data structure in a way that e.g. circle 1 is always and forever circle 1 and has always its own characteristics?

plagron
  • 21
  • 2
  • if you're dealing with a video with a constant background, just doing frame subtraction can save you the first 3 steps and get you a better end result. If Hough-Circles doesn't give you a good enough detection, at least it's easier to remove noise from the subtracted image than the original. See [here](http://docs.opencv.org/3.0-beta/doc/tutorials/video/background_subtraction/background_subtraction.html). One thing though, it's sort of important that the balls travel fast enough, or that you look at frames far apart enough, that they keep appearing in different positions on the image. – ljetibo Oct 27 '15 at 13:08
  • Thank you, I will try with the background subtraction. But why is it so important that the circles move fast? Actually the movement is very slow, and I should track the objects for long periods. The final purpouse is to make some statistics on these movements in time. – plagron Oct 27 '15 at 16:04
  • Depending on the type of background, question isn't specific enough, if you can have a static image of the background without circles known in advance they don't have to move fast. In other cases, your subtraction might return just a crescent or somesuch shape. Bckg subtraction is more of an "idea" than actual implementation which can be more case specific. Bckg sub. only leaves "changed" pixels behind, so if parts of a red circle overlap with parts of a red circle from the frame before they might not be there in the subtracted frame. – ljetibo Oct 27 '15 at 20:04

0 Answers0