使用GVF域和VFC域进行图片分割
% Vector field convolution (VFC) external force field example.
%
% See also AMT, EXAMPLE_PIG, AM_VFC, AM_VFK, AC_DISPLAY.
%
% Reference
% [1] Bing Li and Scott T. Acton, "Active contour external force using
% vector field convolution for image segmentation," Image Processing,
% IEEE Trans. on, vol. 16, pp. 2096-2106, 2007.
% [2] Bing Li and Scott T. Acton, "Automatic Active Model
% Initialization via Poisson Inverse Gradient," Image Processing,
% IEEE Trans. on, vol. 17, pp. 1406-1420, 2008.
%
% (c) Copyright Bing Li 2005 - 2009.
clear all
disp('======================================')
disp('Vector field convolution (VFC) example')
%% parameter settings
disp('Initializing parameters ...')
SAVE_AVI = 0; % set it to 1 if you want to save the process as .avi movie
DISPLAY_STREAMLINE = 0; % set it to 1 if you want to plot streamlines, note that it takes a while
mu = .2;
GVF_ITER = 100;
normalize = 1;
alpha = .5;
beta = 0;
tau = .5;
SNAKE_ITER = 5;
SNAKE_ITER1 = 60;
RES = .5;
clr = {'b' 'b' 'r'};
%% Read images
disp('Reading images ...')
U = imread('im_U.bmp');
noisyU=imread('im_Unoisy.bmp');
figure(1)
%% compare 3 different cases
for cs = 1:3,
%% compute external force fields
switch cs,
case 1, % traditional GVF with Gaussian filter
disp('--------------------------------------------------')
disp('Case 1: GVF snake with initial circle close to FOI')
disp('Computing the external force field ...')
h = fspecial('gaussian',[5 5],5);
f = imfilter(double(noisyU),h);
titl = 'GVF';
Fext = AM_GVF(f, mu, GVF_ITER, normalize);
R = 20;
case 2, % traditional GVF with Gaussian filter
disp('--------------------------------------------------')
disp('Case 2: GVF snake with initial circle far away from FOI')
disp('Computing the external force field ...
1