Open In App

How to Find Interior and Exterior Skeleton of Binary Images Using MATLAB?

Skeletonization is a process for reducing foreground regions in a binary image to a skeletal remnant that largely preserves the extent and connectivity of the original region while throwing away most of the original foreground pixels. In this article, we will see how to find interior and exterior skeleton of binary images using MATLAB in-built function.

Thinning: Thinning is a morphological operation performed on binary images. It removes some selected foreground pixels from binary images and hence thins the image. Mathematically, it is the difference of binary image and the result of hit-or-miss transformation applied on the same binary image.



Function Used: 

Example:






% Find Skeleton of a binary image.
% read the image.
k=imread('skeleton.png');
 
% Convert into grayscale.
k=rgb2gray(k);
 
% apply morphological operation.
k1=bwmorph(k,'skel',Inf);
 
% display original image.
imtool(k);
 
% display skeleton of image.
imtool(k1);

Output:

Figure 1: Input image

 

Figure 2:Output image

Figure 3: Results on GFGlogo

Example:




% MATLAB code for remove
% inner pixels of image.
% read the image.
k=imread('skeleton.png');
 
% Convert into grayscale.
k=rgb2gray(k);
 
% Apply morphological operation.
k2=bwmorph(k,'remove',Inf);
 
% display original image.
imtool(k);
 
% display boundary image.
imtool(k2);

 
 

Output:

 

Figure 4: Input image 

 

 

Figure 5: Output image

 

Figure 6: Result on GFGlogo

 


Article Tags :