Image Processing Averaging Filter
13 ビュー (過去 30 日間)
古いコメントを表示
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
2019 年 10 月 10 日
You are not adding noise anywhere. About your question itself: how would you calculate an average on paper?
回答 (1 件)
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');
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!