Class SupperpixelSEEDS
Class implementing the SEEDS (Superpixels Extracted via Energy-Driven Sampling) superpixels algorithm described in Michael Van den Bergh, Xavier Boix, Gemma Roig, Benjamin de Capitani, and Luc Van Gool. Seeds: Superpixels extracted via energy-driven sampling. In Computer Vision-ECCV 2012, pages 13-26. Springer, 2012.
public class SupperpixelSEEDS : UnmanagedObject, IDisposable
- Inheritance
-
SupperpixelSEEDS
- Implements
- Inherited Members
Constructors
SupperpixelSEEDS(int, int, int, int, int, int, int, bool)
The function initializes a SuperpixelSEEDS object for the input image.
public SupperpixelSEEDS(int imageWidth, int imageHeight, int imageChannels, int numSuperpixels, int numLevels, int prior, int histogramBins, bool doubleStep)
Parameters
imageWidth
intImage width
imageHeight
intImage height
imageChannels
intNumber of channels of the image.
numSuperpixels
intDesired number of superpixels. Note that the actual number may be smaller due to restrictions (depending on the image size and num_levels). Use getNumberOfSuperpixels() to get the actual number.
numLevels
intNumber of block levels. The more levels, the more accurate is the segmentation, but needs more memory and CPU time.
prior
intEnable 3x3 shape smoothing term if >0. A larger value leads to smoother shapes. prior must be in the range [0, 5].
histogramBins
intNumber of histogram bins.
doubleStep
boolIf true, iterate each block level twice for higher accuracy.
Properties
NumberOfSuperpixels
The function computes the superpixels segmentation of an image with the parameters initialized with the function createSuperpixelSEEDS().
public int NumberOfSuperpixels { get; }
Property Value
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 SuperpixelSEEDS object.
public void GetLabelContourMask(IOutputArray image, bool thickLine = false)
Parameters
image
IOutputArrayReturn: CV_8UC1 image mask where -1 indicates that the pixel is a superpixel border, and 0 otherwise.
thickLine
boolIf 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
IOutputArrayReturn: A CV_32UC1 integer array containing the labels of the superpixel segmentation. The labels are in the range [0, NumberOfSuperpixels].
Iterate(IInputArray, int)
Calculates the superpixel segmentation on a given image with the initialized parameters in the SuperpixelSEEDS object.
public void Iterate(IInputArray img, int numIterations = 4)
Parameters
img
IInputArrayInput image. Supported formats: CV_8U, CV_16U, CV_32F. Image size & number of channels must match with the initialized image size & channels with the function createSuperpixelSEEDS(). It should be in HSV or Lab color space. Lab is a bit better, but also slower.
numIterations
intNumber of pixel level iterations. Higher number improves the result.
Remarks
This function can be called again for other images without the need of initializing the algorithm with createSuperpixelSEEDS(). This save the computational cost of allocating memory for all the structures of the algorithm.