当前位置: 首页>>编程示例 >>用法及示例精选 >>正文


Python skimage.future.graph.cut_normalized用法及代码示例

用法:

skimage.future.graph.cut_normalized(labels, rag, thresh=0.001, num_cuts=10, in_place=True, max_edge=1.0, *, random_state=None)

对 Region Adjacency Graph 执行 Normalized Graph cut。

给定图像的标签及其相似性 RAG,递归地对其执行 2-way normalized cut。属于不能被进一步切割的子图的所有节点在输出中被分配一个唯一的标签。

参数

labelsndarray

标签数组。

ragRAG

区域邻接图。

thresh浮点数

门槛。如果N-cut的值超过阈值,则不会进一步细分子图。

num_cutsint

在确定最佳值之前要执行的编号或N-cuts。

in_placebool

如果设置,修改rag到位。对于每个节点n该函数将设置一个新属性rag.nodes[n]['ncut label'].

max_edge浮点数,可选

RAG 中边的最大可能值。这对应于相同区域之间的边。这用于将自身边放入 RAG。

random_state{无,int numpy.random.Generator },可选

如果random_state是没有的numpy.random.Generator使用单例。如果random_state是一个int 一个新的Generator使用实例,播种random_state.如果random_state已经是一个Generator实例然后使用该实例。

random_state用于起点scipy.sparse.linalg.eigsh.

返回

outndarray

新标记的数组。

参考

1

Shi, J.; Malik, J., “Normalized cuts and image segmentation”, Pattern Analysis and Machine Intelligence, IEEE Transactions on, vol. 22, no. 8, pp. 888-905, August 2000.

例子

>>> from skimage import data, segmentation
>>> from skimage.future import graph
>>> img = data.astronaut()
>>> labels = segmentation.slic(img)
>>> rag = graph.rag_mean_color(img, labels, mode='similarity')
>>> new_labels = graph.cut_normalized(labels, rag)

相关用法


注:本文由纯净天空筛选整理自scikit-image.org大神的英文原创作品 skimage.future.graph.cut_normalized。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。