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

Class implementing the F-DBSCAN (Accelerated superpixel image segmentation with a parallelized DBSCAN algorithm) superpixels algorithm by Loke SC, et al. [158] for original paper. More...

#include <opencv2/ximgproc/scansegment.hpp>

Inheritance diagram for cv::ximgproc::ScanSegment:
cv::Algorithm

Public Member Functions

virtual ~ScanSegment ()
 
virtual void getLabelContourMask (OutputArray image, bool thick_line=false)=0
 Returns the mask of the superpixel segmentation stored in the ScanSegment object. More...
 
virtual void getLabels (OutputArray labels_out)=0
 Returns the segmentation labeling of the image. More...
 
virtual int getNumberOfSuperpixels ()=0
 Returns the actual superpixel segmentation from the last image processed using iterate. More...
 
virtual void iterate (InputArray img)=0
 Calculates the superpixel segmentation on a given image with the initialized parameters in the ScanSegment 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 (FileStorage &fs, const String &name) const
 
void write (const Ptr< FileStorage > &fs, const String &name=String()) const
 

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 F-DBSCAN (Accelerated superpixel image segmentation with a parallelized DBSCAN algorithm) superpixels algorithm by Loke SC, et al. [158] for original paper.

The algorithm uses a parallelised DBSCAN cluster search that is resistant to noise, competitive in segmentation quality, and faster than existing superpixel segmentation methods. When tested on the Berkeley Segmentation Dataset, the average processing speed is 175 frames/s with a Boundary Recall of 0.797 and an Achievable Segmentation Accuracy of 0.944. The computational complexity is quadratic O(n2) and more suited to smaller images, but can still process a 2MP colour image faster than the SEEDS algorithm in OpenCV. The output is deterministic when the number of processing threads is fixed, and requires the source image to be in Lab colour format.

Constructor & Destructor Documentation

◆ ~ScanSegment()

virtual cv::ximgproc::ScanSegment::~ScanSegment ( )
virtual

Member Function Documentation

◆ getLabelContourMask()

virtual void cv::ximgproc::ScanSegment::getLabelContourMask ( OutputArray  image,
bool  thick_line = false 
)
pure virtual
Python:
cv.ximgproc.ScanSegment.getLabelContourMask([, image[, thick_line]]) -> image

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

The function return the boundaries of the superpixel segmentation.

Parameters
imageReturn: CV_8UC1 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.

◆ getLabels()

virtual void cv::ximgproc::ScanSegment::getLabels ( OutputArray  labels_out)
pure virtual
Python:
cv.ximgproc.ScanSegment.getLabels([, labels_out]) -> 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_32UC1 integer array containing the labels of the superpixel segmentation. The labels are in the range [0, getNumberOfSuperpixels()].

◆ getNumberOfSuperpixels()

virtual int cv::ximgproc::ScanSegment::getNumberOfSuperpixels ( )
pure virtual
Python:
cv.ximgproc.ScanSegment.getNumberOfSuperpixels() -> retval

Returns the actual superpixel segmentation from the last image processed using iterate.

Returns zero if no image has been processed.

◆ iterate()

virtual void cv::ximgproc::ScanSegment::iterate ( InputArray  img)
pure virtual
Python:
cv.ximgproc.ScanSegment.iterate(img) -> None

Calculates the superpixel segmentation on a given image with the initialized parameters in the ScanSegment object.

This function can be called again for other images without the need of initializing the algorithm with createScanSegment(). This save the computational cost of allocating memory for all the structures of the algorithm.

Parameters
imgInput image. Supported format: CV_8UC3. Image size must match with the initialized image size with the function createScanSegment(). It MUST be in Lab color space.

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