Info

This question is closed. Reopen it to edit or answer.

I have added (0 mean,std=30) noise to uploaded image

1 view (last 30 days)
vipul utsav
vipul utsav on 6 Feb 2013
Closed: MATLAB Answer Bot on 20 Aug 2021
I have added (0 mean,std=30) noise to grayscale image. and i also uploaded my code to find additive noise from noisy image. but i have got wrong std(std=180). please help me to correct my code.
I have made this code using datamasking algorithm for noise estimation.
In this algorithm first noisy image should filtered using laplacian mask and then filterd image contain additive noise with only edges.To generate edges pixel, laplacian filterd image filterd by sobel edge detector.And then this edge pixels removed from laplacian filtered image. and this resultant image represent additive noise.
clc;
clear all;
close all;
%image read
I = imread('cameraman.tif');
n=0+(30*randn(size(I)));
subplot(2,2,1);
imshow(I,[]);
title('original Image');
%n=uint8(n);
I=double(I);
%generate noisy image
e=I+n;
subplot(2,2,2);
imshow(e,[]);
title('noisy Image');
%apply laplacian mask to generate noise
h=[1 -2 1
-2 4 -2
1 -2 1];
mm = imfilter(e,h);
subplot(2,2,3);
imshow(mm,[]);
title('laplacian Image');
nn=double(mm);
std(nn(:))
%apply sobel mask to laplaciuan image to generate sobel edge image
mm1=edge(mm,'sobel');
%make edge pixels is equal to laplacian pixels
for ii=1:256
for jj=1:256
if(mm1(ii,jj)==1)
mm2(ii,jj)=mm(ii,jj);
else
mm2(ii,jj)=0;
end
end
end
%mm2=uint8(mm2);
subplot(2,2,4);
imshow(mm2,[]);
title('sobel Image');
ss2=double(mm2);
std(ss2(:))
%subtract edge pixels from laplacian image to generate final noise
mm3=mm-mm2;
figure
imshow(mm3,[])
nn1=double(mm3);
std(nn1(:)) %final noise

Answers (0)

Community Treasure Hunt

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

Start Hunting!