cut-threshold

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 rag in place. The function will remove the edges with weights less that thresh. If set to False the function makes a copy of rag before 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)
doc_scikit_image
2017-01-12 17:20:41
Comments
Leave a Comment

Please login to continue.