Table of Contents

Class SupperpixelSLIC

Namespace
Emgu.CV.XImgproc
Assembly
Emgu.CV.dll

Class implementing the SLIC (Simple Linear Iterative Clustering) superpixels algorithm described in Radhakrishna Achanta, Appu Shaji, Kevin Smith, Aurelien Lucchi, Pascal Fua, and Sabine Susstrunk. Slic superpixels compared to state-of-the-art superpixel methods. IEEE Trans. Pattern Anal. Mach. Intell., 34(11):2274-2282, nov 2012.

public class SupperpixelSLIC : UnmanagedObject, IDisposable
Inheritance
SupperpixelSLIC
Implements
Inherited Members

Constructors

SupperpixelSLIC(IInputArray, Algorithm, int, float)

The function initializes a SuperpixelSLIC object for the input image. It sets the parameters of choosed superpixel algorithm, which are: region_size and ruler. It preallocate some buffers for future computing iterations over the given image.

public SupperpixelSLIC(IInputArray image, SupperpixelSLIC.Algorithm algorithm, int regionSize, float ruler)

Parameters

image IInputArray

Image to segment

algorithm SupperpixelSLIC.Algorithm

Chooses the algorithm variant to use

regionSize int

Chooses an average superpixel size measured in pixels

ruler float

Chooses the enforcement of superpixel smoothness factor of superpixel

Properties

NumberOfSuperpixels

Calculates the actual amount of superpixels on a given segmentation computed and stored in SuperpixelSLIC object.

public int NumberOfSuperpixels { get; }

Property Value

int

Methods

DisposeObject()

Release the unmanaged memory associated with this object.

protected override void DisposeObject()

EnforceLabelConnectivity(int)

The function merge component that is too small, assigning the previously found adjacent label to this component.Calling this function may change the final number of superpixels.

public void EnforceLabelConnectivity(int minElementSize = 25)

Parameters

minElementSize int

The minimum element size in percents that should be absorbed into a bigger superpixel.Given resulted average superpixel size valid value should be in 0-100 range, 25 means that less then a quarter sized superpixel should be absorbed, this is default.

GetLabelContourMask(IOutputArray, bool)

Returns the mask of the superpixel segmentation stored in SuperpixelSLIC object.

public void GetLabelContourMask(IOutputArray image, bool thickLine = true)

Parameters

image IOutputArray

CV_8U1 image mask where -1 indicates that the pixel is a superpixel border, and 0 otherwise.

thickLine bool

If false, the border is only one pixel wide, otherwise all pixels at the border are masked.

GetLabels(IOutputArray)

Returns the segmentation labeling of the image. Each label represents a superpixel, and each pixel is assigned to one superpixel label.

public void GetLabels(IOutputArray labels)

Parameters

labels IOutputArray

A CV_32SC1 integer array containing the labels of the superpixel segmentation. The labels are in the range [0, NumberOfSuperpixels].

Iterate(int)

Calculates the superpixel segmentation on a given image with the initialized parameters in the SuperpixelSLIC object. This function can be called again without the need of initializing the algorithm with createSuperpixelSLIC(). This save the computational cost of allocating memory for all the structures of the algorithm.

public void Iterate(int numIterations = 10)

Parameters

numIterations int

Number of iterations. Higher number improves the result.