Image Processing Averaging Filter
18 views (last 30 days)
Show older comments
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 Comments
Rik
on 10 Oct 2019
You are not adding noise anywhere. About your question itself: how would you calculate an average on paper?
Answers (1)
Rik
on 10 Oct 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');
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!