OpenCV  4.0.1
Open Source Computer Vision
Public Member Functions | List of all members
cv::ximgproc::SuperpixelSLIC Class Referenceabstract

Class implementing the SLIC (Simple Linear Iterative Clustering) superpixels algorithm described in [1]. More...

#include "slic.hpp"

Inheritance diagram for cv::ximgproc::SuperpixelSLIC:
cv::Algorithm

Public Member Functions

virtual void enforceLabelConnectivity (int min_element_size=25)=0
 Enforce label connectivity. More...
 
virtual void getLabelContourMask (OutputArray image, bool thick_line=true) const =0
 Returns the mask of the superpixel segmentation stored in SuperpixelSLIC object. More...
 
virtual void getLabels (OutputArray labels_out) const =0
 Returns the segmentation labeling of the image. More...
 
virtual int getNumberOfSuperpixels () const =0
 Calculates the actual amount of superpixels on a given segmentation computed and stored in SuperpixelSLIC object. More...
 
virtual void iterate (int num_iterations=10)=0
 Calculates the superpixel segmentation on a given image with the initialized parameters in the SuperpixelSLIC object. More...
 
- Public Member Functions inherited from cv::Algorithm
 Algorithm ()
 
virtual ~Algorithm ()
 
virtual void clear ()
 Clears the algorithm state. More...
 
virtual bool empty () const
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. More...
 
virtual String getDefaultName () const
 
virtual void read (const FileNode &fn)
 Reads algorithm parameters from a file storage. More...
 
virtual void save (const String &filename) const
 
virtual void write (FileStorage &fs) const
 Stores algorithm parameters in a file storage. More...
 
void write (const Ptr< FileStorage > &fs, const String &name=String()) const
 simplified API for language bindings This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from cv::Algorithm
template<typename _Tp >
static Ptr< _Tp > load (const String &filename, const String &objname=String())
 Loads algorithm from the file. More...
 
template<typename _Tp >
static Ptr< _Tp > loadFromString (const String &strModel, const String &objname=String())
 Loads algorithm from a String. More...
 
template<typename _Tp >
static Ptr< _Tp > read (const FileNode &fn)
 Reads algorithm from the file node. More...
 
- Protected Member Functions inherited from cv::Algorithm
void writeFormat (FileStorage &fs) const
 

Detailed Description

Class implementing the SLIC (Simple Linear Iterative Clustering) superpixels algorithm described in [1].

SLIC (Simple Linear Iterative Clustering) clusters pixels using pixel channels and image plane space to efficiently generate compact, nearly uniform superpixels. The simplicity of approach makes it extremely easy to use a lone parameter specifies the number of superpixels and the efficiency of the algorithm makes it very practical. Several optimizations are available for SLIC class: SLICO stands for "Zero parameter SLIC" and it is an optimization of baseline SLIC descibed in [1]. MSLIC stands for "Manifold SLIC" and it is an optimization of baseline SLIC described in [122].

Member Function Documentation

§ enforceLabelConnectivity()

virtual void cv::ximgproc::SuperpixelSLIC::enforceLabelConnectivity ( int  min_element_size = 25)
pure virtual
Python:
None=cv.ximgproc_SuperpixelSLIC.enforceLabelConnectivity([, min_element_size])

Enforce label connectivity.

Parameters
min_element_sizeThe 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.

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

virtual void cv::ximgproc::SuperpixelSLIC::getLabelContourMask ( OutputArray  image,
bool  thick_line = true 
) const
pure virtual
Python:
image=cv.ximgproc_SuperpixelSLIC.getLabelContourMask([, image[, thick_line]])

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

Parameters
imageReturn: CV_8U1 image mask where -1 indicates that the pixel is a superpixel border, and 0 otherwise.
thick_lineIf false, the border is only one pixel wide, otherwise all pixels at the border are masked.

The function return the boundaries of the superpixel segmentation.

§ getLabels()

virtual void cv::ximgproc::SuperpixelSLIC::getLabels ( OutputArray  labels_out) const
pure virtual
Python:
labels_out=cv.ximgproc_SuperpixelSLIC.getLabels([, labels_out])

Returns the segmentation labeling of the image.

Each label represents a superpixel, and each pixel is assigned to one superpixel label.

Parameters
labels_outReturn: A CV_32SC1 integer array containing the labels of the superpixel segmentation. The labels are in the range [0, getNumberOfSuperpixels()].

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

§ getNumberOfSuperpixels()

virtual int cv::ximgproc::SuperpixelSLIC::getNumberOfSuperpixels ( ) const
pure virtual
Python:
retval=cv.ximgproc_SuperpixelSLIC.getNumberOfSuperpixels()

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

§ iterate()

virtual void cv::ximgproc::SuperpixelSLIC::iterate ( int  num_iterations = 10)
pure virtual
Python:
None=cv.ximgproc_SuperpixelSLIC.iterate([, num_iterations])

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.

Parameters
num_iterationsNumber of iterations. Higher number improves the result.

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.


The documentation for this class was generated from the following file: