views:

148

answers:

1
function sk=skeleton_finding(x)

% calculate distance transform
dt=bwdist(~x,'cityblock');

% find the local maximum
n=[0 1;-1 0;0 -1;1 0];
sk=dt>0;
for i=1:4
sk=sk&(dt>=circshift(dt,n(i,:)));
end

Can someone illustrate with an intuitive image that applies this transform?

+3  A: 

Skeleton finding


Skeleton finding is the same as ridge finding in the sense of finding the centerline. The difference is, skeletonization usually find the centerline in an object described by its boundary points, while ridge finding seeks the centerline in an volume. However skeletonization can be done by finding ridges in the distance map.

D = bwdist(BW) computes the Euclidean distance transform of the binary image BW. For each pixel in BW, the distance transform assigns a number that is the distance between that pixel and the nearest nonzero pixel of BW. bwdist uses the Euclidean distance metric by default. BW can have any dimension. D is the same size as BW.

Here is how CITY-BLOCK distance is calculated by bwDist.

NOTE: You might want to replace the circshift-call with a loop. Here's why.

GoodLUCK!!

CVS @ 2600Hertz

CVS-2600Hertz
Can you illustrate the effect of the function by an image?
@user198729: Why don't you create a binary image and see for yourself what the function does?
Jonas