【图像去噪】小波域双重局部维纳滤波图像去噪(含PSNR)【含Matlab源码 1642期】

本文介绍了Matlab中图像去噪的方法,包括空间域滤波(如邻域平均法、中值滤波)、变换域滤波(如傅立叶和小波变换)、偏微分方程和基于小波阈值的降噪策略。通过实际的Matlab代码展示了去噪过程和效果评估。
摘要由CSDN通过智能技术生成

✅博主简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,Matlab项目合作可私信。
🍎个人主页:海神之光
🏆代码获取方式:
海神之光Matlab王者学习之路—代码获取方式
⛳️座右铭:行百里者,半于九十。

更多Matlab仿真内容点击👇
Matlab图像处理(进阶版)
路径规划(Matlab)
神经网络预测与分类(Matlab)
优化求解(Matlab)
语音处理(Matlab)
信号处理(Matlab)
车间调度(Matlab)

⛄一、图像去噪及滤波简介

1 图像去噪
1.1 图像噪声定义
噪声是干扰图像视觉效果的重要因素,图像去噪是指减少图像中噪声的过程。噪声分类有三种:加性噪声,乘性噪声和量化噪声。我们用f(x,y)表示图像,g(x,y)表示图像信号,n(x,y)表示噪声。
图像去噪是指减少数字图像中噪声的过程。现实中的数字图像在数字化和传输过程中常受到成像设备与外部环境噪声干扰等影响,称为含噪图像或噪声图像。去噪是图像处理研究中的一个重点内容。在图像的获取、传输、发送、接收、复制、输出等过程中,往往都会产生噪声,其中的椒盐噪声是比较常见的一种噪声,它属于加性噪声。

1.2 图像噪声来源
(1)图像获取过程中
图像传感器CCD和CMOS采集图像过程中受传感器材料属性、工作环境、电子元器件和电路结构等影响,会引入各种噪声。
(2)图像信号传输过程中
传输介质和记录设备等的不完善,数字图像在其传输记录过程中往往会受到多种噪声的污染。

1.3 噪声分类
噪声按照不同的分类标准可以有不同的分类形式:
基于产生原因:内部噪声,外部噪声。
基于噪声与信号的关系:
加性噪声:加性噪声和图像信号强度是不相关的,这类带有噪声的图像g可看成为理想无噪声图像f与噪声n之和:
g = f + n;
乘性嗓声:乘性噪声和图像信号是相关的,往往随图像信号的变化而变化,载送每一个象素信息的载体的变化而产生的噪声受信息本身调制。在某些情况下,如信号变化很小,噪声也不大。为了分析处理方便,常常将乘性噪声近似认为是加性噪声,而且总是假定信号和噪声是互相统计独立。
g = f + f*n
按照基于统计后的概率密度函数:
是比较重要的,主要因为引入数学模型这就有助于运用数学手段去除噪声。在不同场景下噪声的施加方式都不同,由于在外界的某种条件下,噪声下图像-原图像(没有噪声时)的概率密度函数(统计结果)服从某种分布函数,那么就把它归类为相应的噪声。下面将具体说明基于统计后的概率密度函数的噪声分类及其消除方式。

1.4 图像去噪算法的分类
(1)空间域滤波
空域滤波是在原图像上直接进行数据运算,对像素的灰度值进行处理。常见的空间域图像去噪算法有邻域平均法、中值滤波、低通滤波等。
(2)变换域滤波
图像变换域去噪方法是对图像进行某种变换,将图像从空间域转换到变换域,再对变换域中的变换系数进行处理,再进行反变换将图像从变换域转换到空间域来达到去除图像嗓声的目的。将图像从空间域转换到变换域的变换方法很多,如傅立叶变换、沃尔什-哈达玛变换、余弦变换、K-L变换以及小波变换等。而傅立叶变换和小波变换则是常见的用于图像去噪的变换方法。
(3)偏微分方程
偏微分方程是近年来兴起的一种图像处理方法,主要针对低层图像处理并取得了很好的效果。偏微分方程具有各向异性的特点,应用在图像去噪中,可以在去除噪声的同时,很好的保持边缘。偏微分方程的应用主要可以分为两类:一种是基本的迭代格式,通过随时间变化的更新,使得图像向所要得到的效果逐渐逼近,这种算法的代表为Perona和Malik的方程,以及对其改进后的后续工作。该方法在确定扩散系数时有很大的选择空间,在前向扩散的同时具有后向扩散的功能,所以,具有平滑图像和将边缘尖锐化的能力。偏微分方程在低噪声密度的图像处理中取得了较好的效果,但是在处理高噪声密度图像时去噪效果不好,而且处理时间明显高出许多。
(4)变分法
另一种利用数学进行图像去噪方法是基于变分法的思想,确定图像的能量函数,通过对能量函数的最小化工作,使得图像达到平滑状态,现在得到广泛应用的全变分TV模型就是这一类。这类方法的关键是找到合适的能量方程,保证演化的稳定性,获得理想的结果。
形态学噪声滤除器将开与闭结合可用来滤除噪声,首先对有噪声图像进行开运算,可选择结构要素矩阵比噪声尺寸大,因而开运算的结果是将背景噪声去除;再对前一步得到的图像进行闭运算,将图像上的噪声去掉。据此可知,此方法适用的图像类型是图像中的对象尺寸都比较大,且没有微小细节,对这类图像除噪效果会较好。

2 基于邻域的小波阈值
(1) Bayes Shrink阈值
假设信号为{fj,i,j=1,…,N},N是2的幂,它被一加性随机噪声污染,记为:
gj=fy+占,i,j=1,…,N
其中aj是独立同分布(iid independence identical distribution) 的均值为零的正态分布, 并且独立于fy。去噪的目标是得到fy的估计值f^, 使均方误差(MSE Mean Square Error) 最小。
1
令g={9mhj, f={f hj, e={a jhj, 又令Y=Wg, X=Wf, V=We, 其中W表示二进正交小波算子。于是可得:Y=X+V(3)
文献[1] 中, 在贝叶斯估计理论框架下, 假设小波系数服从广义高斯分布(GGD) , 即:
在这里插入图片描述
其中,
在这里插入图片描述
在这里插入图片描述

⛄二、部分源代码

clear;close all;

%---------Load the original image and show it------------------------------
im_original=imread(‘images\lena.png’,‘png’);% load the original image
im_original=double(im_original); % convert it to double
figure(1);imshow(im_original,[]);title(‘The original image’);% show it

%--------Generate a noisy image, the noise is assumed to be additive,------
%--------white,Gaussian and independent of the original image--------------
sigma=25; % Standard deviation of the noise
im_noisy=im_original+sigma*randn(size(im_original));% Generate noisy image

%--------Show the noisy image----------------------------------------------
figure(2);imshow(im_noisy,[]);title(‘The noisy image’);

%--------Set the parameters of the denoising algorithm---------------------
% Attention: the parameters is set for reproducing the result of our IEEE
% Signal Processing Letters paper, do not change them unless you
% are an advanced user with a deep understanding of the theory.
wav_base1=‘db4’; % the wavelet base used in the first LWFDW
wav_base2=‘sym8’;% the wavelet base used in the second LWFDW
level=5; % the wavelet decomposition level
pad_mode=0;% 0:stands for the period extention mode
% 1:stands for the symmetric extention mode

symbol=0; % 0: stands for denoising using Decimated wavelet transform
% 1: stands for denoising using Undecimated wavelet transform

% If symbol=0, uncomment the following 4 code lines for reproducing the
% results of denoising image using maximal decimated wavelet transform
r1=[5,4,4,3,3];a1=2; % the parameters of the directional window used in
% the first LWFDW under Decimated wavelet transform
r2=[3,2,2,1,1];a2=1.5;% the parameters of the directional window used in
% the second LWFDW

% If symbol=1, uncomment the following 4 code lines for reproducing the
% results of denoising image using Undecimated wavelet transform
% r1=[7,8,8,9,9];a1=2; % the parameters of the directional window used in
% % first LWFDW under Undecimated wavelet transform
% r2=[3,4,4,5,5];a2=2;% the parameters of the directional window used in
% % the second LWFDW

%--------Call the denoising function to denoise the noisy image------------
tic;
im_denoised=denoise_DLWFDW(im_noisy,wav_base1,wav_base2,level,r1,a1…
,r2,a2,pad_mode,symbol);
toc;

%--------Compute the PSNR and show the result------------------------------
PSNR=10*log10(255^2/mse(im_original-im_denoised))
figure(3);imshow(im_denoised,[]);title(‘The denoised image using DLWFDW’);
function im_denoised=DLWFDW_DWT(im_noisy,wav_base1,wav_base2,level,…
r1,a1,r2,a2);
% DLWFDW using the maximal decimated wavelet transform
% written by Peng-lang Shui and Zuo-feng Zhou
% last revision:16/8/2007

%-------maximal decimated wavelet decomposition using the DWT2-------------
t=im_noisy;index=1;
% estimate the standard deviation of the noise using the MAD estimator
[tt,ht,vt,dt]=dwt2(im_noisy,wav_base1,‘mode’,‘per’);
sigma=median(median(abs(dt)))/.6745;

% wavelet decomposition and the first local Wiener filtering
% with directional windows
for i=1:level
[t,h,v,d]=dwt2(t,wav_base1,‘mode’,‘per’);
% for horizontal subband
W=elliptic_window(r1(i),1/a1,1);% generate the directional window
M=sum(sum(W)); % the size of the window
var=max(0,filter2(W,h.2-sigma2)/M);% the signal variance
h=(var./(var+sigma^2)).*h; % local Wiener filtering
% for vertical subband
W=elliptic_window(r1(i),a1,1);% generate the directional window
M=sum(sum(W)); % the size of the window
var=max(0,filter2(W,v.2-sigma2)/M);% the signal variance
v=(var./(var+sigma^2)).*v; % local Wiener filtering
% for diagonal subband
W=elliptic_window(r1(i),a1,2);% generate the directional window
M=sum(sum(W)); % the size of the window
var=max(0,filter2(W,d.2-sigma2)/M);% the signal variance
d=(var./(var+sigma^2)).*d; % local Wiener filtering

coeff{index}=h;coeff{index+1}=v;coeff{index+2}=d;index=index+3;

end

% wavelet reconstruction to get the pilot image
for i=1:level
t=idwt2(t,coeff{(level-i+1)*3-2},coeff{(level-i+1)*3-1},…
coeff{(level-i+1)*3},wav_base1,‘mode’,‘per’);
end
im_pilot=t;% get the pilot image

% The second local Wiener filtering with directional windows
t_p=im_pilot;t_n=im_noisy;index=1;
for i=1:level
[t_p,h_p,v_p,d_p]=dwt2(t_p,wav_base2,‘mode’,‘per’);
[t_n,h_n,v_n,d_n]=dwt2(t_n,wav_base2,‘mode’,‘per’);
% for horizontal subband
W=elliptic_window(r2(i),1/a2,1);% generate the directional window
M=sum(sum(W)); % the size of the window
var=max(0,filter2(W,h_p.^2)/M); % the signal variance
h_n=(var./(var+sigma^2)).*h_n; % local Wiener filtering
% for vertical subband
W=elliptic_window(r2(i),a2,1); % generate the directional window
M=sum(sum(W)); % the size of the window
var=max(0,filter2(W,v_p.^2)/M); % the signal variance
v_n=(var./(var+sigma^2)).*v_n; % local Wiener filtering
% for diagonal subband
W=elliptic_window(r2(i),a2,2); % generate the directional window
M=sum(sum(W)); % the size of the window
var=max(0,filter2(W,d_p.^2)/M); % the signal variance
d_n=(var./(var+sigma^2)).*d_n; % local Wiener filtering

coeff{index}=h_n;coeff{index+1}=v_n;coeff{index+2}=d_n;index=index+3;

end

⛄三、运行结果

在这里插入图片描述
在这里插入图片描述

⛄四、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1] 蔡利梅.MATLAB图像处理——理论、算法与实例分析[M].清华大学出版社,2020.

3 备注
简介此部分摘自互联网,仅供参考,若侵权,联系删除

🍅 仿真咨询
1 各类智能优化算法改进及应用

生产调度、经济调度、装配线调度、充电优化、车间调度、发车优化、水库调度、三维装箱、物流选址、货位优化、公交排班优化、充电桩布局优化、车间布局优化、集装箱船配载优化、水泵组合优化、解医疗资源分配优化、设施布局优化、可视域基站和无人机选址优化

2 机器学习和深度学习方面
卷积神经网络(CNN)、LSTM、支持向量机(SVM)、最小二乘支持向量机(LSSVM)、极限学习机(ELM)、核极限学习机(KELM)、BP、RBF、宽度学习、DBN、RF、RBF、DELM、XGBOOST、TCN实现风电预测、光伏预测、电池寿命预测、辐射源识别、交通流预测、负荷预测、股价预测、PM2.5浓度预测、电池健康状态预测、水体光学参数反演、NLOS信号识别、地铁停车精准预测、变压器故障诊断

3 图像处理方面
图像识别、图像分割、图像检测、图像隐藏、图像配准、图像拼接、图像融合、图像增强、图像压缩感知

4 路径规划方面
旅行商问题(TSP)、车辆路径问题(VRP、MVRP、CVRP、VRPTW等)、无人机三维路径规划、无人机协同、无人机编队、机器人路径规划、栅格地图路径规划、多式联运运输问题、车辆协同无人机路径规划、天线线性阵列分布优化、车间布局优化

5 无人机应用方面
无人机路径规划、无人机控制、无人机编队、无人机协同、无人机任务分配

6 无线传感器定位及布局方面
传感器部署优化、通信协议优化、路由优化、目标定位优化、Dv-Hop定位优化、Leach协议优化、WSN覆盖优化、组播优化、RSSI定位优化

7 信号处理方面
信号识别、信号加密、信号去噪、信号增强、雷达信号处理、信号水印嵌入提取、肌电信号、脑电信号、信号配时优化

8 电力系统方面
微电网优化、无功优化、配电网重构、储能配置

9 元胞自动机方面
交通流 人群疏散 病毒扩散 晶体生长

10 雷达方面
卡尔曼滤波跟踪、航迹关联、航迹融合

  • 21
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值