Matlab Code 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');

Input Image

RESULT:

###  The PSNR value  ###

PSNR = +11.21 dB

Output

Contact:
Mr. Roshan P. Helonde
Mobile: +91-7276355704
WhatsApp: +91-7276355704
Email: roshanphelonde@rediffmail.com
Share:

Total Pageviews

CONTACT US

Prof. Roshan P. Helonde
Mobile: +917276355704
WhatsApp: +917276355704
Email: roshanphelonde@rediffmail.com

Enter Project Title

Popular Projects

All Archive

Contact Form

Name

Email *

Message *