OpenCV 4.12.0
开源计算机视觉
加载中...
搜索中...
无匹配项
cv::ximgproc::SuperpixelSLIC 类参考抽象类

实现 SLIC (Simple Linear Iterative Clustering) 超像素算法的类,该算法在 [1] 中进行了描述。 更多...

#include <opencv2/ximgproc/slic.hpp>

cv::ximgproc::SuperpixelSLIC 的协作图

公共成员函数

virtual void enforceLabelConnectivity (int min_element_size=25)=0
 强制标签连接性。
 
virtual void getLabelContourMask (OutputArray image, bool thick_line=true) const =0
 返回存储在 SuperpixelSLIC 对象中的超像素分割的掩码。
 
virtual void getLabels (OutputArray labels_out) const =0
 返回图像的分割标签。
 
virtual int getNumberOfSuperpixels () const =0
 计算给定分割上超像素的实际数量,该分割已计算并存储在 SuperpixelSLIC 对象中。
 
virtual void iterate (int num_iterations=10)=0
 使用 SuperpixelSLIC 对象中的初始化参数,计算给定图像上的超像素分割。
 
- 从 cv::Algorithm 继承的公共成员函数
 Algorithm ()
 
virtual ~Algorithm ()
 
virtual void clear ()
 清除算法状态。
 
virtual bool empty () const
 如果 Algorithm 为空(例如,在最开始或读取失败后),则返回 true。
 
virtual String getDefaultName () const
 
virtual void read (const FileNode &fn)
 从文件存储中读取算法参数。
 
virtual void save (const String &filename) const
 
void write (const Ptr< FileStorage > &fs, const String &name=String()) const
 
virtual void write (FileStorage &fs) const
 将算法参数存储到文件存储中。
 
void write (FileStorage &fs, const String &name) const
 

其他继承的成员

- 从 cv::Algorithm 继承的静态公共成员函数
template<typename _Tp >
static Ptr< _Tpload (const String &filename, const String &objname=String())
 从文件中加载算法。
 
template<typename _Tp >
static Ptr< _TploadFromString (const String &strModel, const String &objname=String())
 从字符串加载算法。
 
template<typename _Tp >
static Ptr< _Tpread (const FileNode &fn)
 从文件节点读取算法。
 
- 从 cv::Algorithm 继承的保护成员函数
void writeFormat (FileStorage &fs) const
 

详细描述

实现 SLIC (Simple Linear Iterative Clustering) 超像素算法的类,该算法在 [1] 中进行了描述。

SLIC(简单线性迭代聚类)使用像素通道和图像平面空间来有效地生成紧凑、几乎均匀的超像素来聚类像素。该方法的简单性使其非常易于使用:一个单独的参数指定超像素的数量,并且算法的效率使其非常实用。 SLIC 类有几个优化:SLICO 代表“零参数 SLIC”,它是 [1] 中描述的基线 SLIC 的优化。 MSLIC 代表“流形 SLIC”,它是 [172] 中描述的基线 SLIC 的优化。

成员函数文档

◆ enforceLabelConnectivity()

virtual void cv::ximgproc::SuperpixelSLIC::enforceLabelConnectivity ( int min_element_size = 25)
纯虚函数
Python
cv.ximgproc.SuperpixelSLIC.enforceLabelConnectivity([, min_element_size]) ->

强制标签连接性。

参数
min_element_size应吸收到更大的超像素中的最小元素大小(以百分比表示)。给定结果的平均超像素大小,有效值应在 0-100 范围内,25 表示应吸收小于四分之一大小的超像素,这是默认值。

该函数合并太小的组件,将先前找到的相邻标签分配给此组件。调用此函数可能会更改超像素的最终数量。

◆ getLabelContourMask()

virtual void cv::ximgproc::SuperpixelSLIC::getLabelContourMask ( OutputArray image,
bool thick_line = true ) const
纯虚函数
Python
cv.ximgproc.SuperpixelSLIC.getLabelContourMask([, image[, thick_line]]) -> image

返回存储在 SuperpixelSLIC 对象中的超像素分割的掩码。

参数
image返回值:CV_8U1 图像掩码,其中 -1 表示像素是超像素边界,否则为 0。
thick_line如果为 false,则边界仅为一个像素宽,否则边界上的所有像素都将被屏蔽。

该函数返回超像素分割的边界。

◆ getLabels()

virtual void cv::ximgproc::SuperpixelSLIC::getLabels ( OutputArray labels_out) const
纯虚函数
Python
cv.ximgproc.SuperpixelSLIC.getLabels([, labels_out]) -> labels_out

返回图像的分割标签。

每个标签代表一个超像素,每个像素都分配给一个超像素标签。

参数
labels_out返回值:一个 CV_32SC1 整数数组,包含超像素分割的标签。标签的范围为 [0, getNumberOfSuperpixels()]。

该函数返回带有超像素分割标签的图像。标签的范围为 [0, getNumberOfSuperpixels()]。

◆ getNumberOfSuperpixels()

virtual int cv::ximgproc::SuperpixelSLIC::getNumberOfSuperpixels ( ) const
纯虚函数
Python
cv.ximgproc.SuperpixelSLIC.getNumberOfSuperpixels() -> retval

计算给定分割上超像素的实际数量,该分割已计算并存储在 SuperpixelSLIC 对象中。

◆ iterate()

virtual void cv::ximgproc::SuperpixelSLIC::iterate ( int num_iterations = 10)
纯虚函数
Python
cv.ximgproc.SuperpixelSLIC.iterate([, num_iterations]) ->

使用 SuperpixelSLIC 对象中的初始化参数,计算给定图像上的超像素分割。

无需使用 createSuperpixelSLIC() 初始化算法,就可以再次调用此函数。这节省了为算法的所有结构分配内存的计算成本。

参数
num_iterations迭代次数。迭代次数越多,结果越好。

该函数使用使用 createSuperpixelSLIC() 函数初始化的参数来计算图像的超像素分割。该算法从超像素网格开始,然后通过提出边缘边界的更新来细化边界。


此类文档由以下文件生成