skimage2.segmentation.quickshift#
- skimage2.segmentation.quickshift(image, ratio=1.0, kernel_size=5, max_dist=10, return_tree=False, sigma=0, convert2lab=True, rng=42, *, channel_axis=-1)[source]#
Segment image using quickshift clustering in Color-(x,y) space.
Produces an oversegmentation of the image using the quickshift mode-seeking algorithm.
- Parameters:
- imagendarray of shape (M, N, C)
Input image. The axis corresponding to color channels can be specified via the
channel_axisargument.- ratiofloat, optional, between 0 and 1
Balances color-space proximity and image-space proximity. Higher values give more weight to color-space.
- kernel_sizefloat, optional
Width of Gaussian kernel used in smoothing the sample density. Higher means fewer clusters.
- max_distfloat, optional
Cut-off point for data distances. Higher means fewer clusters.
- return_treebool, optional
Whether to return the full segmentation hierarchy tree and distances.
- sigmafloat, optional
Width for Gaussian smoothing as preprocessing. Zero means no smoothing.
- convert2labbool, 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()). Ifrngis an int, it is used to seed the generator.The PRNG is used to break ties, and is seeded with 42 by default.
- channel_axisint, optional
The axis of
imagecorresponding to color channels. Defaults to the last axis.
- Returns:
- segment_maskndarray 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.
References
[1]Quick shift and kernel methods for mode seeking, Vedaldi, A. and Soatto, S. European Conference on Computer Vision, 2008