cows.skeletonize¶
- cows.skeletonize(image, periodic=False)[source]¶
Compute the skeleton of a binary image.
Thinning is used to reduce each connected component in a binary image to a single-pixel wide skeleton.
- Parameters:
image (ndarray, 2D or 3D) – A binary image containing the objects to be skeletonized. Zeros represent background, nonzero values are foreground.
periodic (bool) – If True, the skeletonization uses periodic boundary conditions for the input array. Input array must be 3D.
- Returns:
skeleton (ndarray) – The thinned image.
Notes
The method of [Lee94] uses an octree data structure to examine a 3x3x3 neighborhood of a pixel. The algorithm proceeds by iteratively sweeping over the image, and removing pixels at each iteration until the image stops changing. Each iteration consists of two steps: first, a list of candidates for removal is assembled; then pixels from this list are rechecked sequentially, to better preserve connectivity of the image.
References
[Lee94]T.-C. Lee, R.L. Kashyap and C.-N. Chu, Building skeleton models via 3-D medial surface/axis thinning algorithms. Computer Vision, Graphics, and Image Processing, 56(6):462-478, 1994.