【图像分割】距离正则化水平集演化及其在图像分割中的应用(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代码及文献

相关推荐
吾爱星辰36 分钟前
Kotlin 处理字符串和正则表达式(二十一)
java·开发语言·jvm·正则表达式·kotlin
ChinaDragonDreamer37 分钟前
Kotlin:2.0.20 的新特性
android·开发语言·kotlin
IT良38 分钟前
c#增删改查 (数据操作的基础)
开发语言·c#
Kalika0-02 小时前
猴子吃桃-C语言
c语言·开发语言·数据结构·算法
_.Switch2 小时前
Python Web 应用中的 API 网关集成与优化
开发语言·前端·后端·python·架构·log4j
代码雕刻家2 小时前
课设实验-数据结构-单链表-文教文化用品品牌
c语言·开发语言·数据结构
一个闪现必杀技2 小时前
Python入门--函数
开发语言·python·青少年编程·pycharm
Fan_web2 小时前
jQuery——事件委托
开发语言·前端·javascript·css·jquery
龙图:会赢的2 小时前
[C语言]--编译和链接
c语言·开发语言
XKSYA(小巢校长)4 小时前
NatGo我的世界联机篇
开发语言·php