File Exchange

image thumbnail

Mean shift pixel cluster

version 1.1 (190 KB) by

This toy code implements the classic and basic pixel clustering using mean shifts



View License

This is a good demo of showing how the mean shift idea works for image pixel clustering.

Comments and Ratings (9)

the code does not work properly


TDJIO (view profile)


I run it in matlab 2014a by test another jpg file. The whole matlab becomes no response at all. I get no result.

Jincheng Pang


How to use this to cluster 3D points?

i need this picture of parrot sir will u please mail this image on

Nathan Orloff

I tried this code. I can't get it to work. I am getting this error.

Subscript indices must either be real positive integers or logicals.

Error in meanShiftPixCluster (line 111)
intensityKernel = repmat( prod( reshape( weight_map(
xDiffSq+1 ), height, width, depth) , 3 ), [1,1, depth]);

My image is a double. So grayscale.



Milani (view profile)

Thank you



11/30: fixed one previous bug reported by users, and added new figures to visualize differences before and after applying meanshift pixel clustering.

MATLAB Release
MATLAB 8.0 (R2012b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video