Image segmentation with mean-shift algorithms

This Java applet is intended to illustrate the following three algorithms for image segmentation:

The basic idea underlying mean-shift algorithms is to define a density function (specifically, a Gaussian kernel density estimate) on the pixels of the image and iteratively move the pixels to the modes of the density function (in blurring mean-shift algorithms, the density is updated itself at each iteration). Each pixel is represented by a feature vector in a higher dimensional space (3D for greyscale, 5D for colour) of location (x,y) and intensity (z) or colour value (r,g,b). The feature vectors (pixels) that converge to the same mode are clustered into the same segment. For full details, see the references.

The applet panel below contains 3 panels horizontally:

The applet embedded in this web page can only load a predetermined set of images and cannot save the segmented image. You can download a standalone version of the Java applet that does not have these limitations.

To use the applet:

  1. Load an image of dimensions less than or equal to 256×256 pixels.
  2. Choose an algorithm from the drop down menu.
  3. Modify the values of the user parameters (or keep the default ones).
  4. Press GO! and watch the algorithm run.
  5. Save the result or run it again with a different image, algorithm or values.

The runtime of the algorithms is quadratic on the number of pixels (a few seconds with a 64×64 image, a few minutes with a 128×128 image).

User parameters: the main parameter to change is σ, in order to obtain more or fewer segments.


Matlab software and animations are also available in the publications page.

  1. Carreira-Perpiñán, M. Á. (2006): "Acceleration strategies for Gaussian mean-shift image segmentation". IEEE Conf. Computer Vision and Pattern Recognition (CVPR 2006), pp. 1160-1167.
  2. Carreira-Perpiñán, M. Á. (2006): "Fast nonparametric clustering with Gaussian blurring mean-shift". 23rd Int. Conf. Machine Learning (ICML 2006), pp. 153-160.


Mark Crompton, Jimmy Yih, David L. King, Weiran Wang and Miguel Á. Carreira-Perpiñán (August 2011).

Miguel A. Carreira-Perpinan
Last modified: Mon Aug 1 12:43:52 PDT 2011

UC Merced | EECS | MACP's Home Page