gvf.m
来自「snake 源代码! 源代码!! 很好的东西哦!」· M 代码 · 共 25 行
M
25 行
function [u,v] = GVF(f, mu, ITER)
%GVF Compute gradient vector flow.
% [u,v] = GVF(f, mu, ITER) computes the
% GVF of an edge map f. mu is the GVF regularization coefficient
% and ITER is the number of iterations that will be computed.
% Chenyang Xu and Jerry L. Prince 6/17/97
% Copyright (c) 1996-97 by Chenyang Xu and Jerry L. Prince
% Image Analysis and Communications Lab, Johns Hopkins University
[fx,fy] = gradient(f); % Calculate the gradient of the edge map
u = fx; v = fy; % Initialize GVF to the gradient
SqrMagf = fx.*fx + fy.*fy; % Squared magnitude of the gradient field
% Iteratively solve for the GVF u,v
for i=1:ITER,
u = u + mu*4*del2(u) - SqrMagf.*(u-fx);
v = v + mu*4*del2(v) - SqrMagf.*(v-fy);
fprintf(1, '%3d', i);
if (rem(i,20) == 0)
fprintf(1, '\n');
end
end
fprintf(1, '\n');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?