资源简介
包括EucilideanSkeleton在内的三种经典细化算法
代码片段和文件信息
function curve = extract_curve(BWGap_size)
% effect: Function to extract curves from binary edge map if the endpoint of a
% contour is nearly connected to another endpoint fill the gap and continue
% the extraction. The default gap size is 1 pixles.
%Inputs:
% BW: the binary image to process.
% Gap_size: gap_size between the pixels of the contour
%Outputs:
% curve: the contour constructed by pixels of counter-clock-wise
% order
%Composed by Su Dongcai on 2009/11/13
[LW]=size(BW);
BW1=zeros(L+2*Gap_sizeW+2*Gap_size);
BW_edge=zeros(LW);
BW1(Gap_size+1:Gap_size+LGap_size+1:Gap_size+W)=BW;
grainNoise=3;
bw_kernel=imfill(BW1 ‘holes‘);
bw_kernel_dist=bwdist(~bw_kernel);
bw_kernel=bw_kernel_dist>=grainNoise;
%extract the maximum region
if sum(bw_kernel)<10
curve=[];
return;
end
L=bwlabel(bw_kernel);
status=regionprops( L ‘Area‘);
[tmp max_idx]=max([status.Area]);
bw_kernel=(L==max_idx);
bw_kernel_dist=bwdist(bw_kernel);
BW1=bw_kernel_dist<=grainNoise;
BW1=bwperim(BW1);
%debuge
%imshow(BW1) hold on;
[rc]=find(BW1==1);
nPerimPixels=sum(BW1(:));
point=[r(1)c(1)];
cur=point;
while nPerimPixels>0
BW1(point(1)point(2))=0;
nr_point=[point(1)-Gap_size : point(1)+Gap_size];
nc_point=[point(2)-Gap_size : point(2)+Gap_size];
n_point=BW1(nr_point nc_point);
[IJ]=find(n_point==1);
if numel(I)==0
break;
end
distanceList=zeros(1 length(I));
for i=1:length(distanceList)
distanceList(i)=norm([I(i) J(i)]-[Gap_size Gap_size]);
end
[tmp min_idx]=min(distanceList);
point(1)=I(min_idx)-Gap_size+point(1)-1;
point(2)=J(min_idx)-Gap_size+point(2)-1;
cur=[cur;point];
nPerimPixels=nPerimPixels-1;
end
%debug
%plot(cur(: 2) cur(: 1)) hold off;
curve = cur-1;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2139 2009-11-16 14:23 细化\EucilideanSkeleton\EucilideanSkeleton\a.gif
文件 1707 2009-11-16 14:23 细化\EucilideanSkeleton\EucilideanSkeleton\b.gif
文件 1745 2009-11-16 14:23 细化\EucilideanSkeleton\EucilideanSkeleton\c.gif
文件 1426 2009-11-16 14:23 细化\EucilideanSkeleton\EucilideanSkeleton\d.gif
文件 1759 2009-11-16 14:23 细化\EucilideanSkeleton\EucilideanSkeleton\e.gif
文件 1867 2009-11-16 14:23 细化\EucilideanSkeleton\EucilideanSkeleton\extract_curve.m
文件 1879 2009-11-16 14:23 细化\EucilideanSkeleton\EucilideanSkeleton\f.gif
文件 1916 2009-11-16 14:23 细化\EucilideanSkeleton\EucilideanSkeleton\g.gif
文件 2182 2009-11-16 14:23 细化\EucilideanSkeleton\EucilideanSkeleton\h.gif
文件 382 2009-11-16 14:23 细化\EucilideanSkeleton\EucilideanSkeleton\inRange.m
文件 63901 2009-11-16 14:23 细化\EucilideanSkeleton\EucilideanSkeleton\skeleton.jpg
文件 5606 2009-11-17 09:46 细化\EucilideanSkeleton\EucilideanSkeleton\wsh_skeleton.m
文件 1523 2009-11-16 20:59 细化\EucilideanSkeleton\license.txt
文件 888 2010-08-09 14:32 细化\VPSN_ImSeg\dtcwt.p
文件 343270 2010-03-05 09:27 细化\VPSN_ImSeg\lena.png
文件 1330 2010-08-09 05:21 细化\VPSN_ImSeg\license.txt
文件 300 2010-08-09 14:46 细化\VPSN_ImSeg\readme.txt
文件 324 2010-08-05 22:27 细化\VPSN_ImSeg\vpnsinterp.m
文件 14138 2010-08-09 14:40 细化\VPSN_ImSeg\vpsnseg.m
文件 1352 2010-08-09 14:08 细化\VPSN_ImSeg\watershed_seg.m
文件 550 2011-03-20 20:20 细化\z\zs.m
文件 426 2011-03-20 20:20 细化\z\zseven.m
文件 427 2011-03-20 20:20 细化\z\zsodd.m
目录 0 2009-11-17 09:48 细化\EucilideanSkeleton\EucilideanSkeleton
目录 0 2011-03-21 19:39 细化\EucilideanSkeleton
目录 0 2011-03-21 19:52 细化\VPSN_ImSeg
目录 0 2011-03-21 19:57 细化\z
目录 0 2011-03-21 19:57 细化
----------- --------- ---------- ----- ----
451037 28
............此处省略1个文件信息
评论
共有 条评论