资源简介

该代码采用了滤波法进行降噪处理。代码中添加的噪声为高斯噪声,采用了标准正态分布和N(0,5)高斯分布两个例子,用户下载后可以根据需要修改噪声类型和噪声参数。代码执行后,可以得到原始图像、加噪声后的图像和滤波后图像的对比结果。

资源截图

代码片段和文件信息

%Function:Noise Removal
%Input:the size of the filter mask

clc;clear all;close all;

%%%%%%%%%%%%%%%%%%%%%%%%
%%%  Input & Imread  %%%
%%%%%%%%%%%%%%%%%%%%%%%%
W_S=input(‘\nPlease Input the Window(N*N) Size N(Odd Number)=:\n‘);
N_flag=input(‘\nWhich Kind of Noise do You Choose(Input 1 or 2):\n1.N(01) Normal Distribution with Mu=0 and Sigma=1\n2.N(025) Normal Distribution with Mu=0 and Sigma=5\n‘);
I0=imread(‘yourimage.jpg‘);
I=rgb2gray(I0);I=double(I);
[MN]=size(I);
if N_flag==1
    I_N=randn(MN);
else
    I_N=normrnd(05MN);
end
J0=I+I_N; %Image with Noise
J=J0;

%%%%%%%%%%%%%%%%%%%
%%%  Filtering  %%%
%%%%%%%%%%%%%%%%%%%
Half_W_S=(W_S-1)/2;
F_matrix=(1/W_S^2)*ones(W_SW_S); %Filter Matri

评论

共有 条评论