資源簡介
經典論文 matlab 實現 代碼,絕對能運行

代碼片段和文件信息
%?This?Matlab?file?demomstrates?a?level?set?method?in?the?following?paper
%????C.?Li?C.?Xu?C.?Gui?and?M.?D.?Fox?“Level?Set?Evolution?Without?Re-initialization:?A?New?Variational?Formulation“
%????in?Proc.?IEEE?Conf.?Computer?Vision?and?Pattern?Recognition?(CVPR‘05)?vol.?1?pp.?430?36?2005.
%
%?Author:?Chunming?Li?all?rights?reserved.
%?E-mail:?li_chunming@hotmail.com
%?URL:??http://vuiis.vanderbilt.edu/~licm/
clear?all;
close?all;
Img?=?imread(‘50.bmp‘);??%?The?same?cell?image?in?the?paper?is?used?here
Img=double(Img(::1));
sigma=1.5;????%?scale?parameter?in?Gaussian?kernel?for?smoothing.
G=fspecial(‘gaussian‘15sigma);??%旋轉對稱高斯低通濾波器,標準方差1.5,大小15*15
Img_smooth=conv2(ImgG‘same‘);??%?二維卷積smooth?image?by?Gaussiin?convolution
[IxIy]=gradient(Img_smooth);??%梯度
f=Ix.^2+Iy.^2;
g=1./(1+f);??%?邊緣指標函數edge?indicator?function.
epsilon=1.5;?%?the?papramater?in?the?definition?of?smoothed?Dirac?function
timestep=5;??%?time?step
mu=0.2/timestep;??%?coefficient?of?the?internal?(penalizing)?energy?term?P(\phi)
??????????%?Note:?the?product?timestep*mu?must?be?less?than?0.25?for?stability!
lambda=5;?%?coefficient?of?the?weighted?length?term?Lg(\phi)
alf=1.5;??%?coefficient?of?the?weighted?area?term?Ag(\phi);
??????????%?Note:?Choose?a?positive(negative)?alf?if?the?initial?contour?is?outside(inside)?the?object.
%?define?initial?level?set?function?(LSF)?as?-c0?0?c0?at?points?outside?on
%?the?boundary?and?inside?of?a?region?R?respectively.
[nrow?ncol]=size(Img);??
c0=4;???
initialLSF=c0*ones(nrowncol);
w=10;
initialLSF(w+1:end-w?w+1:end-w)=0;??%?zero?level?set?is?on?the?boundary?of?R.?
?????????????????????????????????????%?Note:?this?can?be?commented?out.?The?intial?LSF?does?NOT?necessarily?need?a?zero?level?set.
?????????????????????????????????????
initialLSF(w+2:end-w-1?w+2:?end-w-1)=-c0;?%?negative?constant?-c0?inside?of?R?postive?constant?c0?outside?of?R.
u=initialLSF;
figure;imagesc(Img);colormap(gray);hold?on;
[ch]?=?contour(u[0?0]‘r‘);??%輪廓????????????????????????
title(‘Initial?contour‘);
%?start?level?set?evolution
for?n=1:500
????u=EVOLUTION(u?g?lambda?mu?alf?epsilon?timestep?1);?????
????if?mod(n20)==0?????%20的整數倍
????????pause(0.001);
????????imagesc(Img);colormap(gray);hold?on;
????????[ch]?=?contour(u[0?0]‘r‘);?
????????iterNum=[num2str(n)?‘?iterations‘];????????
????????title(iterNum);
????????hold?off;
????end
end
imagesc(Img);colormap(gray);hold?on;
[ch]?=?contour(u[0?0]‘r‘);?
totalIterNum=[num2str(n)?‘?iterations‘];??
title([‘Final?contour?‘?totalIterNum]);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-03-11?16:35??LevelSet_ChunmingLi_v0\
?????文件??????188470??2014-03-10?19:44??LevelSet_ChunmingLi_v0\0.001.bmp
?????文件???????66614??2014-03-11?16:14??LevelSet_ChunmingLi_v0\1.bmp
?????文件??????241470??2014-03-10?20:49??LevelSet_ChunmingLi_v0\50.bmp
?????文件??????188470??2014-03-11?16:14??LevelSet_ChunmingLi_v0\6.bmp
?????文件????????2648??2014-03-11?17:01??LevelSet_ChunmingLi_v0\Demo1.m
?????文件????????2584??2014-03-11?16:14??LevelSet_ChunmingLi_v0\Demo1_ManualBinaryInitial.m
?????文件????????2555??2014-03-11?16:14??LevelSet_ChunmingLi_v0\Demo2.m
?????文件????????2559??2014-03-11?16:14??LevelSet_ChunmingLi_v0\Demo2_ManualBinaryInitial.m
?????文件????????2229??2014-03-11?16:14??LevelSet_ChunmingLi_v0\EVOLUTION.m
?????文件??????801246??2014-03-11?16:14??LevelSet_ChunmingLi_v0\levelset_CVPR05.pdf
?????文件???????66614??2014-03-11?16:14??LevelSet_ChunmingLi_v0\peppers4-0.40.bmp
?????文件???????66614??2014-03-11?16:14??LevelSet_ChunmingLi_v0\peppers_0.5.bmp
?????文件????????8134??2014-03-11?16:14??LevelSet_ChunmingLi_v0\twoObj.bmp
?????文件???????16434??2014-03-11?16:14??LevelSet_ChunmingLi_v0\twocells.bmp
?????文件???????66614??2014-03-11?16:14??LevelSet_ChunmingLi_v0\骨架提取后1.bmp
評論
共有 條評論