资源简介
局部二值拟合模型,LBF,活动轮廓模型的一种,CV模型局部演化,水平集分割,有matlab代码和文献,可以直接运行。
代码片段和文件信息
% This Matlab file demomstrates a level set algorithm based on Chunming Li et al‘s paper:
% “Implicit Active Contours Driven By Local Binary Fitting Energy“ in Proceedings of CVPR‘07
clc;clear all;close all;
c0 =2;
imgID=1;
Im=imread(‘vessel.bmp‘);
%Img=imread(‘vessel2.bmp‘); % uncommont this line to use ther other vessel image
I=Im(::1);
Img=double(Img);
switch imgID
case 1
phi= ones(size(Img(::1))).*c0;
a=43;b=51;c=20;d=28;
phi(a:bc:d) = -c0;
figure;
imshow(I);colormap;
hold on;
plotLevelSet(phi 0 ‘g‘);
hold off;
case 2
[mn]=size(Img(::1));
a=m/2; b=n/2;r=5;
phi= ones(mn).*c0;
phi(a-r:a+rb-r:b+r) = -c0;
imshow(I);colormap;
hold on;
plotLevelSet(phi 0 ‘r‘);
hold off;
case 3
figure;imagesc(Img [0 255]);colormap(gray);hold on; axis off;axis equal;
text(66‘Left click to get points right click to get end point‘‘FontSize‘[12]‘Color‘ ‘g‘);
BW=roipoly;
phi=c0*2*(0.5-BW);
hold on;
[ch] = contour(phi[0 0]‘r‘);
hold off;
end
pause(0.01);
%参数选择
iterNum = 400;
lambda1 = 1.0;
lambda2 = 1.0;
nu = 0.002*255*255;
timestep = 0.1;
mu = 1;
epsilon = 1.0;
% scale parameter in Gaussian kernel
sigma=3.0;
K=fspecial(‘gaussian‘round(2*sigma)*2+1sigma); % Gaussian kernel
KI=conv2(ImgK‘same‘);
KONE=conv2(ones(size(Img))K‘same‘);
% start level set evolution
time = cputime;
for n=1:iterNum
numIter=1;
%level set evolution.
[phif1f2c1c2]=EVOL_LBF(phiImgKKIKONEnutimestepmulambda1lambda2epsilonnumIter);
if mod(n10)==0
pause(0.001);
imagesc(Img [0 255]);colormap(gray);hold on; axis off;
contour(phi[0 0]‘r‘);
iterNum=[num2str(n) ‘ iterations‘];
title(iterNum);
hold off;
end
end
totaltime = cputime - time
imagesc(Img [0 255]);colormap(gray);hold on; axis off;
contour(phi[0 0]‘r‘);
iterNum=[num2str(n) ‘ iterations‘];
title(iterNum);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1162 2018-05-14 07:53 LBF\cq2.jpg
文件 2049 2020-01-07 11:54 LBF\DemoLBF.m
文件 1661 2020-01-07 11:38 LBF\EVOL_LBF.m
文件 30654 2018-05-14 07:53 LBF\I5.bmp
文件 470490 2018-05-14 07:53 LBF\LBF.pdf
文件 20338 2018-05-14 07:53 LBF\mri_nonuniform.bmp
文件 7078 2018-05-14 07:53 LBF\noisyNonUniform.bmp
文件 328 2018-05-14 07:53 LBF\plotLevelSet.m
文件 14286 2018-05-14 07:53 LBF\vessel.bmp
文件 13398 2018-05-14 07:53 LBF\vessel2.bmp
文件 14702 2018-05-14 07:53 LBF\vessel3.bmp
文件 1162 2018-05-14 07:53 LBF\灰度不均.jpg
目录 0 2020-01-07 14:09 LBF
----------- --------- ---------- ----- ----
577308 13
评论
共有 条评论