morph_skeleton_cvip() - perform morphological skeletonization of a binary image.



[outImage] = morph_skeleton_cvip(inImage, filtSkel, numIter, masksType, method)

Input Parameters include :

Output Parameter includes :


The function performs morphological skeletonization on a binary image. If input image is color or gray-scale image, first, binary thresholding is performed on the input image. Then, morphological skeletonization is performed on binary image. The skeletonization filter or mask is square matrix containing 0's,1's and x's or "don't care". Here,don't care element is represented by NaN value. And,don't care elements can match with either 0s or 1s.


1. Scott E Umbaugh. DIGITAL IMAGE PROCESSING AND ANALYSIS: Applications with MATLAB and CVIPtools, 3rd Edition.


% Read image

 inimage = imread('Shapes.bmp');

% Skeletonization filter

 filtSkel1  = [0   0   0;nan     1   nan;1   1   1];

 filtSkel2 = [0 0 0; nan 1 nan; 1 nan 1];

% Number of iterations
 numIter1 = 10;

 numIter2 = 15;

% masksType

 masksType1 = 1;

 masksType2 = 2;

% Method to combine thinning results from all directions.

 method1 = 0;

 method2 = 1;

% Call function

 [outImage1] = morph_skeleton_cvip(inimage, filtSkel1, numIter1, masksType1, method1);

 [outImage2] = morph_skeleton_cvip(inimage, filtSkel2, numIter2, masksType2, method2);

% Display input image

 figure;imshow(inimage);title('Input Image');

% Display output image

 figure; imshow(outImage1,[]); title('Morphological skeleton with default parameters');

 figure; imshow(outImage2,[]); title('Morphological skeleton with user-specified parameters');


Author: Norsang Lama, June 2017
Copyright © 2017-2018 Scott E Umbaugh
For updates visit CVIP Toolbox Website