mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-08 11:26:12 +08:00
handled the function with callbacks
This commit is contained in:
@@ -5,8 +5,8 @@ RAG Merging
|
||||
|
||||
This example constructs a Region Adjacency Graph (RAG) and progressively merges
|
||||
regions that are similar in color. Merging two adjacent regions produces
|
||||
a new regions with all the pixels from the merged regions. Regions are merged
|
||||
until no highly similar regions remain.
|
||||
a new region with all the pixels from the merged regions. Regions are merged
|
||||
until no highly similar region pairs remain.
|
||||
|
||||
"""
|
||||
|
||||
@@ -16,7 +16,7 @@ from skimage import graph, data, io, segmentation, color
|
||||
img = data.coffee()
|
||||
labels = segmentation.slic(img, compactness=30, n_segments=400)
|
||||
g = graph.rag_mean_color(img, labels)
|
||||
labels2 = graph.merge_hierarchical(labels, g, 40)
|
||||
labels2 = graph.merge_hierarchical_mean_color(labels, g, 40)
|
||||
g2 = graph.rag_mean_color(img, labels2)
|
||||
|
||||
out = color.label2rgb(labels2, img, kind='avg')
|
||||
|
||||
Reference in New Issue
Block a user