Reduce all objects to lines in 2-D binary image or 3-D binary volume
B = bwskel(A)
B = bwskel(V)
B = bwskel(___,'MinBranchLength',N)
reduces all objects in the 2-D binary image
B = bwskel(
A to1-pixel wide
curved lines, without changing the essential structure of the image. This process,
called skeletonization, extracts the centerline, preserving
the topology and Euler number of the objects, which correspond to white regions in
the image (logical true).
specifies the minimum branch length
B = bwskel(___,'MinBranchLength',
N of the skeleton.
bwskel removes (prunes) all branches shorter than the
bwskel calculates the length as the number of
pixels in a branch using 8-connectivity for 2-D and 26-connectivity for 3-D. The
default value of
equates to no pruning.
Read a 2-D grayscale image into the workspace and display it.
I = imread('threads.png'); imshow(I)
Perform skeletonization of the image using
bwskel and view the result.
out = bwskel(imbinarize(I)); figure imshow(out)
Prune small spurs that appear on the skeleton and view the result.
out2 = bwskel(imbinarize(I),'MinBranchLength',10); figure imshow(out2)
Load a volumetric data set into the workspace. The name of the data set is
You can view this data set using the Volume Viewer,
spiralVol data set to a binary format which is required by the
spiralVolLogical = imbinarize(spiralVol);
Skeletonize the spiral shape in the data set.
spiralVolSkel = bwskel(spiralVolLogical);
Use the Volume Viewer to view the skeletonized volume,
A— Input binary image
Input 2-D binary image, specified as a nonsparse, 2-D logical array.
V— Input 3-D binary volume
Input binary volume, specified as a nonsparse, 3-D logical array.
B— Output image or volume
Output image or volume, returned as a 2-D or 3-D logical array, the same size as the input image or volume.
skeletonize 2-D images, you might get different results using
bwmorph than when using
Because they use different algorithms, the
uses 4-connectivity with 2-D images;
bwskel function uses the medial axis transform.
 Ta-Chih Lee, Rangasami L. Kashyap and Chong-Nam Chu Building skeleton models via 3-D medial surface/axis thinning algorithms. Computer Vision, Graphics, and Image Processing, 56(6):462-478, 1994.
 Kerschnitzki, M, Kollmannsberger, P, Burghammer, M. et al.,Architecture of the osteocyte network correlates with bone material quality. Journal of Bone and Mineral Research, 28(8):1837-1845, 2013.