{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / segmentation / _quickshift / quickshift

function

skimage.segmentation._quickshift:quickshift

source: /dev/scikit-image/src/skimage/segmentation/_quickshift.py :10

Signature

def   quickshift ( image ratio = 1.0 kernel_size = 5 max_dist = 10 return_tree = False sigma = 0 convert2lab = True rng = 42 * channel_axis = -1 )

Summary

Segment image using quickshift clustering in Color-(x,y) space.

Extended Summary

Produces an oversegmentation of the image using the quickshift mode-seeking algorithm.

Parameters

image : ndarray of shape (M, N, C)

Input image. The axis corresponding to color channels can be specified via the channel_axis argument.

ratio : float, optional, between 0 and 1

Balances color-space proximity and image-space proximity. Higher values give more weight to color-space.

kernel_size : float, optional

Width of Gaussian kernel used in smoothing the sample density. Higher means fewer clusters.

max_dist : float, optional

Cut-off point for data distances. Higher means fewer clusters.

return_tree : bool, optional

Whether to return the full segmentation hierarchy tree and distances.

sigma : float, optional

Width for Gaussian smoothing as preprocessing. Zero means no smoothing.

convert2lab : bool, optional

Whether the input should be converted to Lab colorspace prior to segmentation. For this purpose, the input is assumed to be RGB.

rng : {`numpy.random.Generator`, int}, optional

Pseudo-random number generator. By default, a PCG64 generator is used (see numpy.random.default_rng). If rng is an int, it is used to seed the generator.

The PRNG is used to break ties, and is seeded with 42 by default.

channel_axis : int, optional

The axis of image corresponding to color channels. Defaults to the last axis.

Returns

segment_mask : ndarray of shape (M, N) and dtype int

Integer mask indicating segment labels.

Notes

The authors advocate to convert the image to Lab color space prior to segmentation, though this is not strictly necessary. For this to work, the image must be given in RGB format.

Aliases

  • skimage.segmentation.quickshift