{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / graph / _graph_cut / cut_threshold

function

skimage.graph._graph_cut:cut_threshold

source: /dev/scikit-image/src/skimage/graph/_graph_cut.py :9

Signature

def   cut_threshold ( labels rag thresh in_place = True )

Summary

Combine regions separated by weight less than threshold.

Extended Summary

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.

Examples

from skimage import data, segmentation, graph
img = data.astronaut()
labels = segmentation.slic(img)
rag = graph.rag_mean_color(img, labels)
new_labels = graph.cut_threshold(labels, rag, 10)

Aliases

  • skimage.graph.cut_threshold