?? demo_cv.m
字號:
% Matlad code implementing Chan-Vese model in the paper 'Active Contours Without Edges'
% Author: Chunming Li, all right reserved
% email: li_chunming@hotmail.com
% URL: http://www.engr.uconn.edu/~cmli/research/
clear all;
clc;
Img=imread('house.tif');
% Img=imread('vessel3.bmp');
Img=double(Img(:,:,1));
% get the size
[nrow,ncol] =size(Img);
ic=nrow/2;
jc=ncol/2;
r=40;
initialLSF = sdf2circle(nrow,ncol,ic,jc,r);
u=initialLSF;
numIter = 500;
timestep = 0.1;
lambda_1=1;
lambda_2=1;
nu=0;
h = 1;
epsilon=1;
mu =0.00001*255*255; % tune this parameter for different images
figure;
imagesc(Img,[0 255]);
colormap(gray)
hold on;
contour(u,[0 0],'r');
% % start level set evolution
mov=avifile('example7.avi');
for k=1:numIter
u=EVOL_CV(Img, u, mu, nu, lambda_1, lambda_2, timestep, epsilon, 1); % update level set function
if mod(k,10)==0
pause(.00005);
imagesc(Img,[0 255]);colormap(gray) %每次都讀入圖像
hold on;
contour(u,[0 0],'r');
hold off;
end
F = getframe(gca);
mov = addframe(mov,F);
end;
hold off
mov = close(mov);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -