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

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

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

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

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

目录

[💥1 概述](#💥1 概述)

[📚2 运行结果](#📚2 运行结果)

[2.1 算例1](#2.1 算例1)

[2.2 算例2](#2.2 算例2)

[🎉3 参考文献](#🎉3 参考文献)

[🌈4 Matlab代码及文献](#🌈4 Matlab代码及文献)


💥1 概述

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

📚 2 运行结果

2.1 算例1

2.2 算例2

部分代码:

复制代码
%% 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

%% 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代码及文献

相关推荐
段一凡-华北理工大学2 小时前
向量数据库实战:选型、调优与落地~系列文章12:文本分块策略实战:chunk_size 怎么选?重叠多少?
开发语言·数据库·后端·oracle·rust·工业智能体·高炉智能化
Ljwuhe2 小时前
C++——多态
开发语言·c++
心平气和量大福大3 小时前
C#-WPF-Window主窗体
开发语言·c#·wpf
从零开始的代码生活_4 小时前
C++ 继承详解:访问控制、对象模型、菱形继承与设计取舍
开发语言·c++·后端·学习·算法
云小逸4 小时前
【C++ 第七阶段:模板、泛型编程与工程综合详解】
开发语言·c++
GIS阵地5 小时前
QgsSingleBandPseudoColorRenderer 完整详解(QGIS 3.40.13 C++)
开发语言·前端·c++·qt·qgis
yaoxin5211235 小时前
470. Java 反射 - Member 接口与 AccessFlag
java·开发语言·python
groundhappy5 小时前
idalib安装和codex ida-mcp配置
linux·开发语言·python
小钻风33666 小时前
Spring Boot 文件上传详解:深入理解 MultipartFile 的使用与原理
java·开发语言
2zcode7 小时前
项目文档:基于MATLAB深度卷积神经网络的肺癌CT影像智能检测系统设计与实现
深度学习·matlab·cnn