用法:
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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。