Tutorials>SLIC superpixels

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:

The image to be segmented

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 segmentations regionSize spaning the values 10,30, and regularizer the values 0.01, 0.1, 1.

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) ;