OpenCV
3.2.0
Open Source Computer Vision
|
Class implementing the SEEDS (Superpixels Extracted via Energy-Driven Sampling) superpixels algorithm described in [161] . More...
#include "seeds.hpp"
Public Member Functions | |
virtual | ~SuperpixelSEEDS () |
virtual void | getLabelContourMask (OutputArray image, bool thick_line=false)=0 |
Returns the mask of the superpixel segmentation stored in SuperpixelSEEDS object. More... | |
virtual void | getLabels (OutputArray labels_out)=0 |
Returns the segmentation labeling of the image. More... | |
virtual int | getNumberOfSuperpixels ()=0 |
Calculates the superpixel segmentation on a given image stored in SuperpixelSEEDS object. More... | |
virtual void | iterate (InputArray img, int num_iterations=4)=0 |
Calculates the superpixel segmentation on a given image with the initialized parameters in the SuperpixelSEEDS 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... | |
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 |
Class implementing the SEEDS (Superpixels Extracted via Energy-Driven Sampling) superpixels algorithm described in [161] .
The algorithm uses an efficient hill-climbing algorithm to optimize the superpixels' energy function that is based on color histograms and a boundary term, which is optional. The energy function encourages superpixels to be of the same color, and if the boundary term is activated, the superpixels have smooth boundaries and are of similar shape. In practice it starts from a regular grid of superpixels and moves the pixels or blocks of pixels at the boundaries to refine the solution. The algorithm runs in real-time using a single CPU.
|
virtual |
|
pure virtual |
Returns the mask of the superpixel segmentation stored in SuperpixelSEEDS object.
image | Return: CV_8UC1 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.
|
pure virtual |
Returns the segmentation labeling of the image.
Each label represents a superpixel, and each pixel is assigned to one superpixel label.
labels_out | Return: A CV_32UC1 integer array containing the labels of the superpixel segmentation. The labels are in the range [0, getNumberOfSuperpixels()]. |
The function returns an image with ssthe labels of the superpixel segmentation. The labels are in the range [0, getNumberOfSuperpixels()].
|
pure virtual |
Calculates the superpixel segmentation on a given image stored in SuperpixelSEEDS object.
The function computes the superpixels segmentation of an image with the parameters initialized with the function createSuperpixelSEEDS().
|
pure virtual |
Calculates the superpixel segmentation on a given image with the initialized parameters in the SuperpixelSEEDS object.
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.
img | Input 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. |
num_iterations | Number of pixel level iterations. Higher number improves the result. |
The function computes the superpixels segmentation of an image with the parameters initialized with the function createSuperpixelSEEDS(). The algorithms starts from a grid of superpixels and then refines the boundaries by proposing updates of blocks of pixels that lie at the boundaries from large to smaller size, finalizing with proposing pixel updates. An illustrative example can be seen below.