开发者

What does this MATLAB function do?

开发者 https://www.devze.com 2022-12-27 20:05 出处:网络
function sk=skeleton_finding(x) % calculate dista开发者_运维技巧nce transform dt=bwdist(~x,\'cityblock\');
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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号