What does this MATLAB function do?
function sk=skeleton_finding(x)
% calculate dista开发者_运维技巧nce 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?
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
精彩评论