📄 ggvf.m
字号:
function [u,v] = GGVF(f, mu, ITER)% [u,v] = GGVF(f, mu, ITER)%% Generalized Gradient Vector Flow%% 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% % del2(u) is not the approximation of laplace operator but% 4*del2(u) is the approximation of laplace(u)!!!%% 1/4*4*del2(U) is stable i.e. del2(U) is stable%% dt = 1/4 to make the scheme stable [fx,fy] = gradient(f); % Calculate the gradient of the edge mapu = fx; v = fy; % Initialize GVF to the gradientSqrMagf = fx.*fx + fy.*fy; % Squared magnitude of the gradient fieldK2 = mu*mu;g = exp(-SqrMagf/K2);h = 1-g;b = h;c1 = b.*fx;c2 = b.*fy;% iterate solve the u,vfor i=1:ITER, u = (1-b/4).*u + g.*del2(u) + c1/4; v = (1-b/4).*v + g.*del2(v) + c2/4; fprintf(1,' %d ',i);enddisp(' ');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -