{ } Raw JSON

bundles / skimage latest / skimage / morphology / _skeletonize / skeletonize

function

skimage.morphology._skeletonize:skeletonize

source: /dev/scikit-image/src/skimage/morphology/_skeletonize.py :18

Signature

def   skeletonize ( image * method = None )

Summary

Compute the skeleton of the input image via thinning.

Parameters

image : (M, N[, P]) ndarray of bool or int

The image containing the objects to be skeletonized. Each connected component in the image is reduced to a single-pixel wide skeleton. The image is binarized prior to thinning; thus, adjacent objects of different intensities are considered as one. Zero or False values represent the background, nonzero or True values -- foreground.

method : {'zhang', 'lee'}, optional

Which algorithm to use. Zhang's algorithm [Zha84] only works for 2D images, and is the default for 2D. Lee's algorithm [Lee94] works for 2D or 3D images and is the default for 3D.

Returns

skeleton : (M, N[, P]) ndarray of bool

The thinned image.

Examples

X, Y = np.ogrid[0:9, 0:9]
ellipse = (1./3 * (X - 4)**2 + (Y - 4)**2 < 3**2).astype(bool)
ellipse.view(np.uint8)
skel = skeletonize(ellipse)
skel.view(np.uint8)

See also

medial_axis

Aliases

  • skimage.morphology.skeletonize