Graphics, Imaging, and Games Lab

  • Home
  • About Us
  • Contact
  • Login
Home › Blogs › Bernard Llanos's blog

From the Lab

  • Benchmark
  • Projects
  • Publications
  • Image Galleries
  • Blogs
  • Lab Members
  • Prospective Students
  • Search

SLIC Part 1 - Random Colours

Bernard Llanos — July 11, 2013 - 12:09pm

Related Projects: 
Image Stylization

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 Superpixels Compared to State-of-the-Art Superpixel Methods
Authors: Radhakrishna Achanta, Appu Shaji, Kevin Smith, Aurelien Lucchi, Pascal Fua, and Sabine Süsstrunk
IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. 34, No. 11, November 2012

 

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

Source image

Segmented using regionSize = 27 and regularizer = 0.01

SLIC-segmented image, with randomly-coloured segments. regionSize parameter is 27, and regularizer parameter is 0.01

Smoothed using Cumulative Range Geodesic Filtering (Mask Size of 256 pixels, gamma parameter value of zero)

(regionSize = 27 and regularizer = 0.01)
Cumulative range geodesic filtering (mask size 256, gamma = 0) of an SLIC-segmented image with regionSize = 27 and regularizer = 0.01

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.

(regionSize = 27 and regularizer = 1000)
Cumulative range geodesic filtering (mask size 256, gamma = 0) of an SLIC-segmented image with regionSize = 27 and regularizer = 1000

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.

(regionSize = 86 and regularizer = 0.01)
Cumulative range geodesic filtering (mask size 256, gamma = 0) of an SLIC-segmented image with regionSize = 86 and regularizer = 0.01

(Image source: Bernard Llanos)

  • Bernard Llanos's blog
  • Home
  • About Us
  • Contact
  • Login