Class cv::ximgproc::SuperpixelLSC#

Class implementing the LSC (Linear Spectral Clustering) superpixels algorithm described in [182]. View details

Collaboration diagram for cv::ximgproc::SuperpixelLSC:

Public Member Functions#

Public Member Functions inherited from cv::Algorithm

Return

Name

Description

Algorithm()

~Algorithm()

void

clear()

Clears the algorithm state.

bool

empty()

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.

String

getDefaultName()

void

read(const FileNode & fn)

Reads algorithm parameters from a file storage.

void

save(const String & filename)

void

write(
    const Ptr< FileStorage > & fs,
    const String & name = String() )

void

write(FileStorage & fs)

Stores algorithm parameters in a file storage.

void

write(
    FileStorage & fs,
    const String & name )

Static Public Member Functions#

Static Public Member Functions inherited from cv::Algorithm

Return

Name

Description

static Ptr< _Tp >

load(
    const String & filename,
    const String & objname = String() )

Loads algorithm from the file.

static Ptr< _Tp >

loadFromString(
    const String & strModel,
    const String & objname = String() )

Loads algorithm from a String.

static Ptr< _Tp >

read(const FileNode & fn)

Reads algorithm from the file node.

Additional Inherited Members#

Protected Member Functions inherited from cv::Algorithm

Return

Name

Description

void

writeFormat(FileStorage & fs)

Detailed Description#

Class implementing the LSC (Linear Spectral Clustering) superpixels algorithm described in 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

Member Function Documentation#

enforceLabelConnectivity()#

void cv::ximgproc::SuperpixelLSC::enforceLabelConnectivity(int min_element_size = 25)

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.

Parameters

  • min_element_size — 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.

getLabelContourMask()#

void cv::ximgproc::SuperpixelLSC::getLabelContourMask(
OutputArray image,
bool thick_line = true )

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

The function return the boundaries of the superpixel segmentation.

Parameters

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

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

getLabels()#

void cv::ximgproc::SuperpixelLSC::getLabels(OutputArray labels_out)

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

Parameters

  • labels_out — Return: A CV_32SC1 integer array containing the labels of the superpixel segmentation. The labels are in the range [0, getNumberOfSuperpixels()].

getNumberOfSuperpixels()#

int cv::ximgproc::SuperpixelLSC::getNumberOfSuperpixels()

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

iterate()#

void cv::ximgproc::SuperpixelLSC::iterate(int num_iterations = 10)

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.

Parameters

  • num_iterations — Number of iterations. Higher number improves the result.

Source file#

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