⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dt.m

📁 snake 源代码! 源代码!! 很好的东西哦!
💻 M
字号:
function D = dt(B)
% DT apply Eucledian distance transform
%    D = dt(B) compute the Eucledian distance transform of B
%    B must be a binary map. 
%
% NOTE: this is not an efficient way to implement distance transform. 
%    If one is interested in using DT, one may want to implement its
%    own DT. 

%    Chenyang Xu and Jerry L. Prince 6/17/97
%    Copyright (c) 1996-97 by Chenyang Xu and Jerry L. Prince

[i,j] = find(B);

[n,m] = size(B);
for x = 1:n,
    for y = 1:m,
        dx = i-x;
        dy = j-y;
        dmag = sqrt(dx.*dx+dy.*dy);
	D(x,y) = min(dmag);
    end
end

⌨️ 快捷键说明

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