# Motion Segmentation using Linear Combination of Views

# Matlab Source Code

In this page, you can download the Matlab source code for the motion segmentation algorithm, as it appearns in the paper
Vasileios Zografos and Klas Nordberg. **"Fast and accurate motion segmentation using Linear Combination of Views."**

In Jesse Hoey, Stephen McKenna and Emanuele Trucco, Proceedings of the British Machine Vision Conference, 2011, pages 12.1-12.11

**Download:**

Download here

**Other:**

The spectral clustering function uses the Fast K-means Matlab code by Charles Elkan
You can download it localy here

**Directions for use:**

Place all the downloaded, extracted files from the **"LCV_motion_segmentation.zip"** and **"fast_Kmeans.zip"** in the same directory.
Then to run you need to call the main function **"motion_segmentation_LCV"** that takes 4 parameters:

*Npoints*=How many points to consider closest to each cluster center. Set it to 7 as explained in the paper, although anything above 5 should work.

*clust_size*= The number of clusters to initialise with. Smaller numbers give somewhat worse results but make the method faster. If you set this number to something very high (e.g. above 1000) then
it will take all the points in the scene as clusters. This is the maximum number of clusters one can have. By maxing it out, one can essentially remove this as a tunable parameter.

*coord*= the pixel x,y coordinates (measurement matrix). This is a matrix of 2xFxN, where F is the number of frames, and N the number of points in each frame.

*final_clusters*= the final number of clusters we expect to get (i.e. moving objects). This includes also the background. So 2 objects and background = 3 objects

The output of the algorithm is:

*I* = A Nx1 vector of class labels. This is the clustering results. The cardinality of this column vector is __final_clusters__

*iQ* = the final clustering quality criterion. This is just the kmeans error. The lower the better. Note, it just shows how good the clustering is, not how good the motion segmentation is. For the latter you need to compare against the ground truth. See below.

**Test data:**

Here is some test data from the Hopkins155 (1R2RC sequence).

The s vector is the ground truth. Ideally one should get the I and s vectors to coincide (up to a permutation).

Use this function to compare them.

If you have any quesions or suggestions regarding this software please contact me Vasileios Zografos

Go back to my publications page.