cut_threshold
-
skimage.future.graph.cut_threshold(labels, rag, thresh, in_place=True)[source] -
Combine regions separated by weight less than threshold.
Given an image’s labels and its RAG, output new labels by combining regions whose nodes are separated by a weight less than the given threshold.
Parameters: labels : ndarray
The array of labels.
rag : RAG
The region adjacency graph.
thresh : float
The threshold. Regions connected by edges with smaller weights are combined.
in_place : bool
If set, modifies
ragin place. The function will remove the edges with weights less thatthresh. If set toFalsethe function makes a copy ofragbefore proceeding.Returns: out : ndarray
The new labelled array.
References
[R224] Alain Tremeau and Philippe Colantoni “Regions Adjacency Graph Applied To Color Image Segmentation” http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.11.5274 Examples
>>> from skimage import data, segmentation >>> from skimage.future import graph >>> img = data.astronaut() >>> labels = segmentation.slic(img) >>> rag = graph.rag_mean_color(img, labels) >>> new_labels = graph.cut_threshold(labels, rag, 10)
Please login to continue.