GVF.m
资源名称:Snakes.rar [点击查看]
上传用户:zlding2008
上传日期:2013-05-13
资源大小:1914k
文件大小:1k
源码类别:
2D图形编程
开发平台:
Matlab
- 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');