mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-09 11:33:41 +08:00
working code
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
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(g, labels, 40)
|
||||
g2 = graph.rag_mean_color(img, labels2)
|
||||
|
||||
out = color.label2rgb(labels2, img, kind='avg')
|
||||
out = segmentation.mark_boundaries(out, labels2, (0, 0, 0))
|
||||
io.imshow(out)
|
||||
io.show()
|
||||
Reference in New Issue
Block a user