November 2018
Intermediate to advanced
492 pages
12h 19m
English
In this operation, each connected component in a binary image is reduced to a single pixel-wide skeleton using a morphological thinning operation. The following code block shows how to skeletonize a binary image of a dinosaur:
def plot_images_horizontally(original, filtered, filter_name, sz=(18,7)): pylab.gray() pylab.figure(figsize = sz) pylab.subplot(1,2,1), plot_image(original, 'original') pylab.subplot(1,2,2), plot_image(filtered, filter_name) pylab.show()from skimage.morphology import skeletonizeim = img_as_float(imread('../images/dynasaur.png')[...,3])threshold = 0.5im[im <= threshold] = 0im[im > threshold] = 1skeleton = skeletonize(im)plot_images_horizontally(im, skeleton, 'skeleton',sz=(18,9))
The following screenshot ...
Read now
Unlock full access