test_skeleton.m.svn-base

来自「fast marching method」· SVN-BASE 代码 · 共 49 行

SVN-BASE
49
字号
% test for skeleton and distance transformrep  = 'data/';name = 'mm';name = 'cavern';name = 'toto';%% compute a binary shapen = 200;Ma = load_image([rep name],n-10);Ma = sum(Ma,3);M = zeros(n);M(6:n-5,6:n-5) = Ma;mask = 1-(M==M(1));%% compute the skeleton[skg,rad] = skeleton(mask);% the higher the threshold, the smaller the skeletonsk1 = skg>20;sk2 = pick_curves(mask);sk = {sk1,sk2};nsk = length(sk);clf;for i=1:nsk    %% compute euclidean distance to skeleton    [Dsk1,Qsk] = eucdist2(logical(sk{i}));    %% compute the geodesic distance, should not be exactly the same    % positions along the skeleton    [x,y] = ind2sub(size(mask),find(sk{i}));    skpoints = [x(:)';y(:)'];    CM = zeros(n) + Inf; CM(mask==0) = -Inf;    options.constraint_map = CM; % constraint the propagation inside the shape    [Dsk2,Z,Qsk] = perform_fast_marching(ones(n), skpoints, options);    % display    subplot(nsk,3,1+(i-1)*3);    imagesc(mask+sk{i}); axis image; axis off;    title('skeleton');    subplot(nsk,3,2+(i-1)*3);    imagesc(Dsk1.*mask); axis image; axis off;    title('euclidean distance');    subplot(nsk,3,3+(i-1)*3);    imagesc(Dsk2.*mask); axis image; axis off;    title('geodesic distance');endcolormap jet(256);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?