Table of Contents

Class SuperpixelLSC

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

Class implementing the LSC (Linear Spectral Clustering) superpixels algorithm described in "Zhengqin Li and Jiansheng Chen. Superpixel segmentation using linear spectral clustering. June 2015."

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

Remarks

LSC (Linear Spectral Clustering) produces compact and uniform superpixels with low computational costs. Basically, a normalized cuts formulation of the superpixel segmentation is adopted based on a similarity metric that measures the color similarity and space proximity between image pixels. LSC is of linear computational complexity and high memory efficiency and is able to preserve global properties of images

Constructors

SuperpixelLSC(IInputArray, int, float)

The function initializes a SuperpixelLSC object for the input image.

public SuperpixelLSC(IInputArray image, int regionSize, float ratio)

Parameters

image IInputArray

Image to segment

regionSize int

Chooses an average superpixel size measured in pixels

ratio float

Chooses the enforcement of superpixel compactness factor of superpixel

Properties

NumberOfSuperpixels

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

public int NumberOfSuperpixels { get; }

Property Value

int

Methods

DisposeObject()

Release the unmanaged memory associated with this object.

protected override void DisposeObject()

GetLabelContourMask(IOutputArray, bool)

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

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

Parameters

image IOutputArray

Return: 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 SuperpixelLSC object. This function can be called again without the need of initializing the algorithm with createSuperpixelLSC(). 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.