Show / Hide Table of Contents

Class SuperpixelSLIC

Class implementing the SLIC (Simple Linear Iterative Clustering) superpixels algorithm described in @cite Achanta2012.

Inheritance
System.Object
DisposableObject
DisposableCvObject
Algorithm
SuperpixelSLIC
Implements
ICvPtrHolder
Inherited Members
Algorithm.Write(FileStorage)
Algorithm.Read(FileNode)
Algorithm.Empty
Algorithm.Save(String)
Algorithm.GetDefaultName()
DisposableCvObject.ptr
DisposableCvObject.CvPtr
DisposableObject.DataHandle
DisposableObject.IsDisposed
DisposableObject.IsEnabledDispose
DisposableObject.AllocatedMemory
DisposableObject.AllocatedMemorySize
DisposableObject.Dispose()
DisposableObject.Dispose(Boolean)
DisposableObject.AllocGCHandle(Object)
DisposableObject.AllocMemory(Int32)
DisposableObject.NotifyMemoryPressure(Int64)
DisposableObject.ThrowIfDisposed()
Namespace: OpenCvSharp.XImgProc
Assembly: OpenCvSharp.dll
Syntax
public class SuperpixelSLIC : Algorithm, ICvPtrHolder

Constructors

| Improve this Doc View Source

SuperpixelSLIC(IntPtr)

Creates instance by raw pointer

Declaration
protected SuperpixelSLIC(IntPtr p)
Parameters
Type Name Description
IntPtr p

Methods

| Improve this Doc View Source

Create(InputArray, SLICType, Int32, Single)

Initialize a SuperpixelSLIC object.

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

Declaration
public static SuperpixelSLIC Create(InputArray image, SLICType algorithm = SLICType.SLICO, int regionSize = 10, float ruler = 10F)
Parameters
Type Name Description
InputArray image

Image to segment

SLICType algorithm

Chooses the algorithm variant to use: SLIC segments image using a desired region_size, and in addition SLICO will optimize using adaptive compactness factor, while MSLIC will optimize using manifold methods resulting in more content-sensitive superpixels.

System.Int32 regionSize

Chooses an average superpixel size measured in pixels

System.Single ruler

Chooses the enforcement of superpixel smoothness factor of superpixel

Returns
Type Description
SuperpixelSLIC
| Improve this Doc View Source

DisposeManaged()

Releases managed resources

Declaration
protected override void DisposeManaged()
Overrides
DisposableObject.DisposeManaged()
| Improve this Doc View Source

DisposeUnmanaged()

Declaration
protected override void DisposeUnmanaged()
Overrides
DisposableCvObject.DisposeUnmanaged()
| Improve this Doc View Source

EnforceLabelConnectivity(Int32)

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.

Declaration
public virtual void EnforceLabelConnectivity(int minElementSize = 20)
Parameters
Type Name Description
System.Int32 minElementSize

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.

| Improve this Doc View Source

Get()

Declaration
public override IntPtr Get()
Returns
Type Description
IntPtr
| Improve this Doc View Source

GetLabelContourMask(OutputArray, Boolean)

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

Declaration
public virtual void GetLabelContourMask(OutputArray image, bool thickLine = true)
Parameters
Type Name Description
OutputArray image

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

System.Boolean thickLine

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

| Improve this Doc View Source

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()].

Declaration
public virtual void GetLabels(OutputArray labelsOut)
Parameters
Type Name Description
OutputArray labelsOut
| Improve this Doc View Source

GetNumberOfSuperpixels()

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

Declaration
public virtual int GetNumberOfSuperpixels()
Returns
Type Description
System.Int32
| Improve this Doc View Source

Iterate(Int32)

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.

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

Declaration
public virtual void Iterate(int numIterations = 10)
Parameters
Type Name Description
System.Int32 numIterations

Number of iterations. Higher number improves the result.

Implements

ICvPtrHolder
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX