[][src]Trait opencv::ximgproc::prelude::SuperpixelSLIC

pub trait SuperpixelSLIC: AlgorithmTrait {
    pub fn as_raw_SuperpixelSLIC(&self) -> *const c_void;
pub fn as_raw_mut_SuperpixelSLIC(&mut self) -> *mut c_void; pub fn get_number_of_superpixels(&self) -> Result<i32> { ... }
pub fn iterate(&mut self, num_iterations: i32) -> Result<()> { ... }
pub fn get_labels(&self, labels_out: &mut dyn ToOutputArray) -> Result<()> { ... }
pub fn get_label_contour_mask(
        &self,
        image: &mut dyn ToOutputArray,
        thick_line: bool
    ) -> Result<()> { ... }
pub fn enforce_label_connectivity(
        &mut self,
        min_element_size: i32
    ) -> Result<()> { ... } }

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

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 described in Achanta2012. MSLIC stands for "Manifold SLIC" and it is an optimization of baseline SLIC described in Liu_2017_IEEE.

Required methods

Loading content...

Provided methods

pub fn get_number_of_superpixels(&self) -> Result<i32>[src]

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

pub fn iterate(&mut self, num_iterations: i32) -> Result<()>[src]

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_iterations: Number 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.

C++ default parameters

  • num_iterations: 10

pub fn get_labels(&self, labels_out: &mut dyn ToOutputArray) -> Result<()>[src]

Returns the segmentation labeling of the image.

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

Parameters

  • labels_out: Return: 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()].

pub fn get_label_contour_mask(
    &self,
    image: &mut dyn ToOutputArray,
    thick_line: bool
) -> Result<()>
[src]

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

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.

The function return the boundaries of the superpixel segmentation.

C++ default parameters

  • thick_line: true

pub fn enforce_label_connectivity(
    &mut self,
    min_element_size: i32
) -> Result<()>
[src]

Enforce label connectivity.

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.

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.

C++ default parameters

  • min_element_size: 25
Loading content...

Implementors

Loading content...