⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demo_cv.m

📁 实现无边界主动轮廓的的很好的算法
💻 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 + -