欢迎光临散文网 会员登陆 & 注册

【图像分割】基于水平集图像分割LGIF模型实现医学图像分割附matlab代码

2022-05-12 13:59 作者:Matlab工程师  | 我要投稿

1 简介

基于全局和局部图像信息的水平集模型(LGIF模型),其基本思想是:在演化过程中,既利用图像的全局信息,也利用图像的局部信息来驱动曲线的演化,LGIF模型其实就是将LIF模型和GIF模型(ACM with Global Image Fitting model)两者的优点结合而形成的新模型,其中LIF模型表示图像的局部信息项,GIF模型表示图像的全局信息项。因而,LGIF模型既具有LIF模型的优点,利用图像的局部领域信息,可以在一定程度上处理灰度不均匀的图像;也具有GIF模型的优点,运用图像的全局信息,使得LGIF模型对初始轮廓的位置不敏感。其中,LIF模型的能量泛函定义如下:

2 部分代码

%   Matlab code implementing Chan-Vese model in the paper 'Active Contours Without Edges'%   This method works well for bimodal images, for example the image 'three.bmp'clcclear allclose allc0 =2;imgID=2;Img=imread('cq391.jpg');    U=Img(:,:,1);% the initial level setswitch imgID     case 1       phi= ones(size(Img(:,:,1))).*c0;       a=43;b=51;c=20;d=28;       phi(a:b,c:d) = -c0;       figure;       imshow(Img);colormap;       hold on;       plotLevelSet(phi, 0, 'g');       hold off;    case 2       [m,n]=size(Img(:,:,1));       a=m/2; b=n/2;r=5;       phi= ones(m,n).*c0;       phi(a-r:a+r,b-r:b+r) = -c0;       imshow(Img);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(6,6,'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;       [c,h] = contour(phi,[0 0],'r');       hold off;endpause(1);%参数选择pause(0.1);lambda=0.001*255*255; lambda1=1.0;lambda2=1.0;delta_t =0.1;epsilon=1;mu =1;numIter = 1;% CV和LBF的权重Img=double(U);M=0.05; % scale parameter in Gaussian kernelsigma=3.0;   K=fspecial('gaussian',round(2*sigma)*2+1,sigma); % Gaussian kernelKI=conv2(Img,K,'same');  KONE=conv2(ones(size(Img)),K,'same');% start level set evolutiontime = cputime;for k=1:1000   phi = evolution_LGIF(Img,K,KI,KONE,phi,M,lambda1,lambda2,mu,lambda,delta_t,epsilon,numIter);  % update level set function    if mod(k,5)==0        pause(0.01);        imagesc(Img, [0, 255]);colormap(gray);hold on; axis off;        contour(phi,[0 0],'r');        iterNum=[num2str(k), ' iterations'];        title(iterNum);        hold off;    end    endtotaltime = cputime - time;imagesc(Img, [0, 255]);colormap(gray);hold on; axis off;contour(phi,[0 0],'r');iterNum=[num2str(k), ' iterations'];title(iterNum);

3 仿真结果


4 参考文献

[1]管观华. 基于水平集方法的胰腺图像分割研究. 

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。





【图像分割】基于水平集图像分割LGIF模型实现医学图像分割附matlab代码的评论 (共 条)

分享到微博请遵守国家法律