Image Processing Averaging Filter

19 visualizaciones (últimos 30 días)
Oreoluwa ADESINA
Oreoluwa ADESINA el 10 de Oct. de 2019
Comentada: Oreoluwa ADESINA el 10 de Oct. de 2019
Pleas e I need help with a problem. I have added a zero mean gaussian noise to a particular image. Now I want to aveage copies of this noisy image to produce a cleaner whose least-squares difference from the original is less than 100.
I have been trying to understand how to average multiple copies of the noisy image so far but I dont know how to go about it. Your help will be well appreciated thank you.
This is the code I have so far:
clc;
clear all;
close all;
I=imread('image5.jpg');
[m,n] = size(I); %Image Size
mu = 0 %mean value
sigma = 40 %standard deviation
I=im2double(I);
%% Add noise
I_noise = normrnd(mu,sigma,[m n])
imshow(I_noise)
%%
figure, imshow(I),title('Original Image');
  2 comentarios
Rik
Rik el 10 de Oct. de 2019
You are not adding noise anywhere. About your question itself: how would you calculate an average on paper?
Oreoluwa ADESINA
Oreoluwa ADESINA el 10 de Oct. de 2019
Yeah,I missed that in the original post:
I_noise = imnoise(I, 'gaussian', 0, 1600); % Here I am adding noise to the original image
On paper, I would add multiple images and divide by the number of images I used to get the average. But I dont really understand how to add the noisy images together. Thats where I need help.

Iniciar sesión para comentar.

Respuestas (1)

Rik
Rik el 10 de Oct. de 2019
This should show you one of the multiple way to do this.
%clc;clear all;%you aren't printing anything to the command window, nor are you assuming anything about your variables, so these two are not needed
close all;%you could also use an explicit numbered figure to put your image
I=imread('image5.jpg');
[m,n] = size(I); %Image Size
mu = 0 %mean value
sigma = 40 %standard deviation
I=im2double(I);
I_sum=zeros(size(I));
for N_images=1:5
% Add noise
I_noise = normrnd(mu,sigma,[m n]);%generate noise
I_noisy=I+I_noise;
I_sum=I_sum+I_noisy;
end
I_avg=I_sum/N_images;
figure
subplot(1,2,1)
imshow(I),title('Original image');
subplot(1,3,2)
imshow(I_noisy),title('Example noisy image');
subplot(1,3,3)
imshow(I_avg),title('Averaged noisy image');
  1 comentario
Oreoluwa ADESINA
Oreoluwa ADESINA el 10 de Oct. de 2019
Thank you for your help! I see how I wasn't adding the noise to the image in the first place, I was just generating it. Ill be testing it later today. Thanks again!

Iniciar sesión para comentar.

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by