• 【图像分割】距离正则化水平集演化及其在图像分割中的应用(Matlab代码实现)


    💥💥💞💞欢迎来到本博客❤️❤️💥💥

    🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

    ⛳️座右铭:行百里者,半于九十。

    📋📋📋本文目录如下:🎁🎁🎁

    目录

    💥1 概述

    📚2 运行结果

    2.1 算例1

    2.2 算例2

    🎉3 参考文献

    🌈4 Matlab代码及文献


    💥1 概述

    水平集方法已广泛应用于图像处理和计算机视觉。在传统的水平集公式中,水平集函数在其演化过程中通常会产生不规则性,这可能会导致数值误差并最终破坏演化的稳定性。因此,通常应用一种称为重新初始化的数值补救措施,以定期将降级的水平集函数替换为有符号距离函数。然而,重新初始化的做法不仅引发了严重的问题,如何时以及如何执行,而且还以不希望的方式影响数值精度。本文提出了一种新的变分水平集公式,其中水平集函数的规律性在水平集演化过程中内在地保持。水平集演化导出为梯度流,该梯度流最小化具有距离正则化项的能量泛函和驱动零水平集向所需位置运动的外部能量。距离正则化项是用势函数定义的,使得派生的水平集演化具有独特的前向和后向(FAB)扩散效应,其能够保持水平集函数的所需形状,特别是接近零水平集的有符号距离剖面。这产生了一种新型的水平集演化,称为距离正则化水平集演化(DRLSE)。距离正则化效应消除了重新初始化的需要,从而避免了其引起的数值误差。与传统水平集公式的复杂实现相比,可以使用更简单、更有效的有限差分方案来实现 DRLSE 公式。DRLSE 还允许使用更通用和高效的电平集函数初始化。在其数值实现中,有限差分方案中可以使用相对较大的时间步长来减少迭代次数,同时保证足够的数值精度。为了证明DRLSE公式的有效性,我们将其应用于基于边缘的主动轮廓模型以进行图像分割,并提供一个简单的窄带实现,以大大降低计算成本。

    📚2 运行结果

    2.1 算例1

    2.2 算例2

    部分代码:

    1. %% parameter setting
    2. timestep=5; % time step
    3. mu=0.2/timestep; % coefficient of the distance regularization term R(phi)
    4. iter_inner=5;
    5. iter_outer=40;
    6. lambda=5; % coefficient of the weighted length term L(phi)
    7. alfa=1.5; % coefficient of the weighted area term A(phi)
    8. epsilon=1.5; % papramater that specifies the width of the DiracDelta function
    9. sigma=1.5; % scale parameter in Gaussian kernel
    10. G=fspecial('gaussian',15,sigma);
    11. Img_smooth=conv2(Img,G,'same'); % smooth image by Gaussiin convolution
    12. [Ix,Iy]=gradient(Img_smooth);
    13. f=Ix.^2+Iy.^2;
    14. g=1./(1+f); % edge indicator function.
    15. % initialize LSF as binary step function
    16. c0=2;
    17. initialLSF=c0*ones(size(Img));
    18. % generate the initial region R0 as a rectangle
    19. initialLSF(10:55, 10:75)=-c0;
    20. phi=initialLSF;
    21. figure(1);
    22. mesh(-phi); % for a better view, the LSF is displayed upside down
    23. hold on; contour(phi, [0,0], 'r','LineWidth',2);
    24. title('Initial level set function');
    25. view([-80 35]);
    26. figure(2);
    27. imagesc(Img,[0, 255]); axis off; axis equal; colormap(gray); hold on; contour(phi, [0,0], 'r');
    28. title('Initial zero level contour');
    29. pause(0.5);
    30. potential=2;
    31. if potential ==1
    32. potentialFunction = 'single-well'; % use single well potential p1(s)=0.5*(s-1)^2, which is good for region-based model
    33. elseif potential == 2
    34. potentialFunction = 'double-well'; % use double-well potential in Eq. (16), which is good for both edge and region based models
    35. else
    36. potentialFunction = 'double-well'; % default choice of potential function
    37. end

    %% parameter setting
    timestep=5;  % time step
    mu=0.2/timestep;  % coefficient of the distance regularization term R(phi)
    iter_inner=5;
    iter_outer=40;
    lambda=5; % coefficient of the weighted length term L(phi)
    alfa=1.5;  % coefficient of the weighted area term A(phi)
    epsilon=1.5; % papramater that specifies the width of the DiracDelta function

    sigma=1.5;     % scale parameter in Gaussian kernel
    G=fspecial('gaussian',15,sigma);
    Img_smooth=conv2(Img,G,'same');  % smooth image by Gaussiin convolution
    [Ix,Iy]=gradient(Img_smooth);
    f=Ix.^2+Iy.^2;
    g=1./(1+f);  % edge indicator function.

    % initialize LSF as binary step function
    c0=2;
    initialLSF=c0*ones(size(Img));
    % generate the initial region R0 as a rectangle
    initialLSF(10:55, 10:75)=-c0;  
    phi=initialLSF;

    figure(1);
    mesh(-phi);   % for a better view, the LSF is displayed upside down
    hold on;  contour(phi, [0,0], 'r','LineWidth',2);
    title('Initial level set function');
    view([-80 35]);

    figure(2);
    imagesc(Img,[0, 255]); axis off; axis equal; colormap(gray); hold on;  contour(phi, [0,0], 'r');
    title('Initial zero level contour');
    pause(0.5);

    potential=2;  
    if potential ==1
        potentialFunction = 'single-well';  % use single well potential p1(s)=0.5*(s-1)^2, which is good for region-based model 
    elseif potential == 2
        potentialFunction = 'double-well';  % use double-well potential in Eq. (16), which is good for both edge and region based models
    else
        potentialFunction = 'double-well';  % default choice of potential function
    end

    🎉3 参考文献

    文章中一些内容引自网络,会注明出处或引用为参考文献,难免有未尽之处,如有不妥,请随时联系删除。

    🌈4 Matlab代码及文献

  • 相关阅读:
    GIT开发学习——使用git stash暂存代码
    第9章Linux实操篇-组管理和权限管理
    2022-30周 项目问题整理
    在 KubeSphere 中部署高可用 Redis 集群
    28 mysql 数据记录的 存储更新删除
    迈巴赫S480升级电动后门 手势控制开关
    数据分析技能点-多元分析和应用
    SQLMAP注入参数-其他参数介绍
    【C++】线程池(有点乱待补充)
    Diffusion模型详解
  • 原文地址:https://blog.csdn.net/Ke_Yan_She/article/details/133583414