Image Processing Averaging Filter

13 ビュー (過去 30 日間)
Oreoluwa ADESINA
Oreoluwa ADESINA 2019 年 10 月 10 日
コメント済み: Oreoluwa ADESINA 2019 年 10 月 10 日
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 件のコメント
Rik
Rik 2019 年 10 月 10 日
You are not adding noise anywhere. About your question itself: how would you calculate an average on paper?
Oreoluwa ADESINA
Oreoluwa ADESINA 2019 年 10 月 10 日
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.

サインインしてコメントする。

回答 (1 件)

Rik
Rik 2019 年 10 月 10 日
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 件のコメント
Oreoluwa ADESINA
Oreoluwa ADESINA 2019 年 10 月 10 日
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!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by