Sie sind auf Seite 1von 10

PROJECT TITLE

Skeletonization of An Image

Table of Contents
Brief Description: .......................................................................................................................................... 2
How It Works: ............................................................................................................................................... 3
Steps:..................................................................................................................................................... 3
Guidelines for Use: ................................................................................................................................ 4
Code: ............................................................................................................................................................. 4
Results: .......................................................................................................................................................... 6
Overall Results: ........................................................................................................................................... 10

Brief Description:
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. To see how
this works, imagine that the foreground regions in the input binary image are made
of some uniform slow-burning material. Light fires simultaneously at all points
along the boundary of this region and watch the fire move into the interior. At
points where the fire traveling from two different boundaries meets itself, the fire
will extinguish itself and the points at which this happens form the so called
`quench line'. This line is the skeleton.
The terms medial axis transform (MAT) and skeletonization are often used
interchangeably but we will distinguish between them slightly. The skeleton is
simply a binary image showing the simple skeleton. The MAT on the other hand is
a graylevel image where each point on the skeleton has an intensity which
represents its distance to a boundary in the original object.

Skeleton 1

How It Works:
The skeleton/MAT can be produced in two main ways. The first is to use some
kind of morphological thinning that successively erodes away pixels from the
boundary (while preserving the end points of line segments) until no more thinning
is possible, at which point what is left approximates the skeleton. The alternative
method is to first calculate the distance transform of the image. The skeleton then
lies along the singularities (i.e. creases or curvature discontinuities) in the distance
transform. This latter approach is more suited to calculating the MAT since the
MAT is the same as the distance transform but with all points off the skeleton
suppressed to zero.
Steps:

1:First convert into binary image


2:Then find Distance using Manahaten Distance Formula Distance from Boundary
to centere .

3:And Then using m neighbor technique we give max value to 1 And suppress
every other value.
Guidelines for Use:

The skeleton is useful because it provides a simple and compact representation of a


shape that preserves many of the topological and size characteristics of the original
shape. Thus, for instance, we can get a rough idea of the length of a shape by
considering just the end points of the skeleton and finding the maximally separated
pair of end points on the skeleton.
Code:
close all;
clc;
clear all;
img=imread('E:\sk_9.png');
img=im2bw(img);
imshow(img);
[r,c]=size(img);
b=uint8(zeros(r,c));
M=255;
for i=2:r-1
for j=2:c-1

r1=img(i+1,j);
c1=img(i,j+1);
if(r1==1 || c1==1)
for i2=1:r

for j2=1:c
if(img(i2,j2)==0)

MANH=max(abs(i-i2),abs(j-j2));
End
if(MANH<=M)
M=MANH;
b(i,j)=MANH;
else
b(i,j)=M;
end
end
end
end
M=255;
End

M=255;
end
figure(2)
imshow(mat2gray(b));
F=zeros(r,c);
for i=2:r-2,
for j=2:c-2
if(b(i,j)~=0)
if b(i,j)>=max([b(i-1,j),b(i+1,j),b(i,j-1),b(i,j+1),b(i-1,j+1),b(i-1,j-1),b(i+1,j1),b(i+1,j+1)])
F(i,j)=1;
end
end
end
end
figure(3)
imshow(mat2gray(F));

Results:

Origonal Image

Distance Transform

Skeleton Image

Skeleton:

BY MATLAB FUNCTION RESULT:


BW3 = bwmorph(b,'skel',Inf);
imshow(BW3

RESULT 2:

Original image:

Distance transform:

Skeleton:

BY MATLAB FUNCTION RESULT:

Overall Results:
Our Projects meets specification of skeleton upto 80 to 85 percent correct that
shows a good implementation of algorithm.

Das könnte Ihnen auch gefallen