Showing posts with label Mean Shift Clustering. Show all posts
Showing posts with label Mean Shift Clustering. Show all posts

Friday, January 27, 2012

Mean Shift Clustering/ Segmentation in Matlab

The Mean shift implementation in here is based on the following article. 

Comaniciu, Dorin; Peter Meer (May 2002). "Mean Shift: A Robust Approach Toward Feature Space Analysis". IEEE Transactions on Pattern Analysis and Machine Intelligence (IEEE) 24 (5): 603–619


The original C++ implementation credit goes to here.
Matlab wrapper implementation credit goes there. Read this readme before using this wrapper :) Thanks also goes here.

I faced some troubles during the compilation of "compile_edison_wrapper" where i had used visual studio 2010 as a compiler. 

Here are two problems that I have faced !

Problem 1: end of file of the c++ code is in Mac format. 
solution: After opening *.h or *.cpp in visual studio save them with advanced options....choose windows style end of file.

Problem 2: pow function from math is ambigious. 
solution: convert the first parameter of pow into double. 

Here is my corrected version EDISON matlab wrapper (Click File-->Download) Try the do_mean_shift.m. 
Try 
MinimumRegionArea=40;
I=imread('yourimage.jpg');
[fimg labels modes regsize] = edison_wrapper(uint8(I),@RGB2Luv,'MinimumRegionArea',MinimumRegionArea);



A sample result should look like the following.