To find the PSNR Value for the denoised image
%Let me explain with an example.
%To the input image Iimg applied the 'Salt & Pepper noise' with the noise ratio of 20% and named as 'Nimg'.
%Now for the 'Nimg' i applied median filter and named as Mimg.
%Now i need to find the 'Peak signal noise ratio' PSNR comparison between Mimg and Nimg.
clear all
close all
clc;
Iimg =imread('Moon.tif');
[r c]=size( Iimg );
d=ndims( Iimg );
if d == 3
Iimg =rgb2gray( Iimg );
end
Iimg =double( Iimg );
Iimg = Iimg /225;
Nimg=imnoise( Iimg ,'salt & pepper',0.2);
Mimg =medfilt2( Nimg ,[5 5]);
imshow( Mimg );
clc;
fprintf('\n\n### The PSNR value ###\n\n')
PSNR( Nimg , Mimg );
subplot(1,2,1);imshow(Nimg);title('Noised image');
subplot(1,2,2);imshow(Mimg);title('Denoised image');
Moon.tif:
RESULT:
### The PSNR value ###
PSNR = +11.21 dB
%To the input image Iimg applied the 'Salt & Pepper noise' with the noise ratio of 20% and named as 'Nimg'.
%Now for the 'Nimg' i applied median filter and named as Mimg.
%Now i need to find the 'Peak signal noise ratio' PSNR comparison between Mimg and Nimg.
clear all
close all
clc;
Iimg =imread('Moon.tif');
[r c]=size( Iimg );
d=ndims( Iimg );
if d == 3
Iimg =rgb2gray( Iimg );
end
Iimg =double( Iimg );
Iimg = Iimg /225;
Nimg=imnoise( Iimg ,'salt & pepper',0.2);
Mimg =medfilt2( Nimg ,[5 5]);
imshow( Mimg );
clc;
fprintf('\n\n### The PSNR value ###\n\n')
PSNR( Nimg , Mimg );
subplot(1,2,1);imshow(Nimg);title('Noised image');
subplot(1,2,2);imshow(Mimg);title('Denoised image');
Moon.tif:
RESULT:
### The PSNR value ###
PSNR = +11.21 dB
Comments
Post a Comment