From the Lab
SLIC Part 1 - Random Colours
Bernard Llanos — July 11, 2013 - 11:09am
Introduction
Simple Linear Iterative Clustering is a recently-developed algorithm for segmenting images into regions of similar pixels.
A detailed explanation of SLIC and a comparison of SLIC and other segmentation processes can be found in the following article authored by the inventors of SLIC:
SLIC Implementation
The inventors of SLIC have a freely available C++ implementation at http://ivrg.epfl.ch/research/superpixels. The implementation that I used was a C/MEX-file for MATLAB, available as part of the toolbox at http://www.vlfeat.org/index.html by A. Vedaldi and B. Fulkerson.
The VLFeat SLIC function accepts two parameters (aside from the image itself):
- Region Size: The size of the region. It seems that the average number of pixels in a segment is between (regionSize)^2 and pi*(regionSize/2)^2. In other words, the regions cover average areas between the area of a square with side length equal to regionSize, and the area of a circle with diameter equal to regionSize.
- Regularizer: Increasing the value of this parameter results in segments with smoother contours and more rounded, regular shapes.
Examples of segmentations using different parameter values can be found at http://www.vlfeat.org/overview/slic.html
Motivation
After using SLIC to generate an accurate segmentation of an image, we can process each segment in some manner to obtain an image in which pixels have been altered in ways which respect their neighbourhoods. Subsequently, we can use cumulative range geodesic filtering to smooth away the edges between segments.
One goal we might be able to achieve is to exaggerate the value contrast of an image in the style of 19th century Romantic painting (see, for example, the work of Frederic Edwin Church, http://en.wikipedia.org/wiki/Frederic_Edwin_Church).
Preliminary Results
Source Image
Segmented using regionSize = 27 and regularizer = 0.01
Smoothed using Cumulative Range Geodesic Filtering (Mask Size of 256 pixels, gamma parameter value of zero)
The filtered image seems to retain the edges of the original image very nicely.
If the regularizer parameter is increased significantly, the SLIC segments do not follow the texture of the image as closely, and the smoothed image has a more uniform pattern of colour splotches, as shown below. Strong edges in the image are still preserved.
Lastly, as the regionSize parameter is increased, region colours are not blended together as much for a given constant filtering mask size, as expected. I will probably only use region sizes which are comparable to filtering mask sizes in the future. Also, I would probably try to pick region sizes around the size of the smallest features that I want to preserve in the image.
(Image source: Bernard Llanos)