SLIC is superpixel extraction (segmentation) method based on a local version of k-means. For a detailed description of the algorithm, see the SLIC API reference.

This demo shows how to use SLIC to extract superpixels from this image:

In the simplest form, SLIC can be called as:

% im contains the input RGB image as a SINGLE array
regionSize = 10 ;
regularizer = 10 ;
segments = vl_slic(im, regionSize, regularizer) ;


By making varting regionSize and regularizer one obtains the segmentations:

SLIC is often intended to be applied on top of LAB rather than RGB images. To do this, simpyl convert the image to LAB format before calling vl_slic.

% IM contains the image in RGB format as before
imlab = vl_xyz2lab(vl_rgb2xyz(im)) ;
segments = vl_slic(imlab, 10, 0.1) ;