Table of Contents

Class SuperpixelLSC

Namespace
OpenCvSharp.XImgProc
Assembly
OpenCvSharp.dll

Class implementing the LSC (Linear Spectral Clustering) superpixels algorithm described in @cite LiCVPR2015LSC.

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.

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

Methods

Create(InputArray, int, float)

Class implementing the LSC (Linear Spectral Clustering) superpixels.

The function initializes a SuperpixelLSC object for the input image. It sets the parameters of superpixel algorithm, which are: region_size and ruler.It preallocate some buffers for future computing iterations over the given image.An example of LSC is illustrated in the following picture. For enhanced results it is recommended for color images to preprocess image with little gaussian blur with a small 3 x 3 kernel and additional conversion into CieLAB color space.

EnforceLabelConnectivity(int)

Enforce label connectivity. 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.

GetLabelContourMask(OutputArray, bool)

Returns the mask of the superpixel segmentation stored in SuperpixelLSC object. The function return the boundaries of the superpixel segmentation.

GetLabels(OutputArray)

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

The function returns an image with the labels of the superpixel segmentation.The labels are in the range [0, getNumberOfSuperpixels()].

GetNumberOfSuperpixels()

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

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.

The function computes the superpixels segmentation of an image with the parameters initialized with the function createSuperpixelLSC(). The algorithms starts from a grid of superpixels and then refines the boundaries by proposing updates of edges boundaries.