用法:
skimage.future.graph.rag_mean_color(image, labels, connectivity=2, mode='distance', sigma=255.0)
使用平均颜色计算区域邻接图。
给定图像及其初始分割,该方法构造相应的区域邻接图 (RAG)。 RAG 中的每个节点代表图像中具有相同标签的一组像素。两个相邻区域之间的权重表示两个区域的相似或不相似程度取决于模式参数。
- image:ndarray,形状(M,N,[…,P,] 3)
输入图像。
- labels:ndarray,形状(M,N,[…,P])
标记的图像。这应该比图像少一维。如果图像具有尺寸 (M, N, 3),则标签应具有尺寸 (M, N)。
- connectivity:整数,可选
平方距离小于的像素连通性彼此被认为是相邻的。它的范围可以从 1 到labels.ndim.它的行为与连通性参数输入
scipy.ndimage.generate_binary_structure
.- mode:{‘distance’, ‘similarity’},可选
分配边权重的策略。
‘distance’ :两个相邻区域之间的权重是 ,其中 和 是两个区域的平均颜色。它以平均颜色表示欧几里得距离。
‘similarity’ :两个相邻区域之间的权重是 其中 ,其中 和 是两个区域的平均颜色。它表示两个区域的相似程度。
- sigma:浮点数,可选
当模式为“similarity” 时用于计算。它决定了两种颜色之间应该有多接近,以使它们相应的边权重显著。非常大的 sigma 值可以使任何两种颜色表现得好像它们是相似的。
- out:RAG
区域邻接图。
参数:
返回:
参考:
- 1
Alain Tremeau and Philippe Colantoni “Regions Adjacency Graph Applied To Color Image Segmentation” DOI:10.1109/83.841950
例子:
>>> from skimage import data, segmentation >>> from skimage.future import graph >>> img = data.astronaut() >>> labels = segmentation.slic(img) >>> rag = graph.rag_mean_color(img, labels)
相关用法
- Python skimage.future.graph.rag_boundary用法及代码示例
- Python skimage.future.graph.RAG.__init__用法及代码示例
- Python skimage.future.graph.show_rag用法及代码示例
- Python skimage.future.graph.cut_normalized用法及代码示例
- Python skimage.future.graph.cut_threshold用法及代码示例
- Python skimage.future.graph.ncut用法及代码示例
- Python skimage.future.manual_polygon_segmentation用法及代码示例
- Python skimage.future.manual_lasso_segmentation用法及代码示例
- Python skimage.feature.graycomatrix用法及代码示例
- Python skimage.feature.blob_doh用法及代码示例
- Python skimage.feature.blob_dog用法及代码示例
- Python skimage.filters.unsharp_mask用法及代码示例
- Python skimage.filters.rank.noise_filter用法及代码示例
- Python skimage.filters.gaussian用法及代码示例
- Python skimage.feature.graycoprops用法及代码示例
- Python skimage.feature.corner_orientations用法及代码示例
- Python skimage.filters.threshold_otsu用法及代码示例
- Python skimage.feature.structure_tensor用法及代码示例
- Python skimage.filters.rank.sum用法及代码示例
- Python skimage.filters.window用法及代码示例
- Python skimage.filters.gabor用法及代码示例
- Python skimage.filters.rank.autolevel用法及代码示例
- Python skimage.filters.threshold_li用法及代码示例
- Python skimage.feature.hessian_matrix用法及代码示例
- Python skimage.feature.ORB用法及代码示例
注:本文由纯净天空筛选整理自scikit-image.org大神的英文原创作品 skimage.future.graph.rag_mean_color。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。