# How to gather similar objects in an image?

I am working in a traffic tracking app, I am using a background subtraction approach to obtain information about the moving vehicles. After some morphological operations I obtain blobs of the moving objects. In some cases more than one blob belong to the same object, e.g.

How can I gather the isolated blobs to track only a single object? what features can allow me the fusion of these blobs in a single object? Thanks

First, I personally wouldn't recommend you using background subtraction in general for tracking applications. There are way better methods like L1-minimzation of lasso problems, Kenalized Correlation Filters, Multiple Instance learnng, Struck, and whole bunch of stuff.

But if you must use background subtraction,, here are my thoughts:

You could obviously at the first frame apply some very basic background subtraction algorithm like using median filtering. Now once you get these blobs, you can start generating a dictionary out of each blob. That means you can now treat each blob as an individually part where you learn a dictionary for each. Usually in dictionary learning from first frame, people usually perturb the bounding box covering the blob a little (slight translations)(Maybe by gaussian sampled translations with zero mean) and then collect all these samples and vectorize them into your dictionary matrix. You do this for all the other parts, or blobs if you will.

Now at the first frame you already have the bounding box governing the object ,which is very typical in any tracking problem. Also, you have the bounding box governing all these blobs individually.

What you do next in the next frame is to try track each of these parts independently say using simple cross correlation. At last, you only need to learn one affine transformation that transforms the big box from the previous frame to cover all the blobs in the next frame.

In this approach you divided your main task of tracking from 1 bounding box to smaller ones on which you can use simple methods of tracking. Then you combine 1 bounding box by either learning an affine transformation or simply plotting a minimum bounding box that covers all the other parts.

• Did you mean applying an affine transformation using cross correlation? Do you have some info of this task in a real time application? Aug 24, 2015 at 15:08
• No, I meant solve a least squares solution for the transformation A. min_A ||AX - B||_F ^2. Where A is the transformation matrix, X has all the points under transformation(you should have at least 3 pairs) for a general Affine. B has the points in the next frame. This method can be sovled effiently using SVD resulting in a real time solution. Aug 25, 2015 at 7:11