how can i get the PSNR for an multibanded image?

3 views (last 30 days)
Hi, I have an image which is [307,280,191] and i added some noise to it and i want to get the PSNR between the 2 images (original and noisy)
Thanks

Accepted Answer

Youssef  Khmou
Youssef Khmou on 9 Apr 2013
Edited: Youssef Khmou on 9 Apr 2013
hi,
In the PDF file "PSNR_RGB.pdf" you will find how to implement the PSNR for 3D array .
function y=PSNR_RGB(X,Y)
% Y= PSNR_RGB(X,Y)
% Computes the Peak Signal to Noise Ratio for two RGB images
% Class input : double [0,1] ,
% july ,25, 2012
% KHMOU Youssef
if size(X)~=size(Y)
error('The images must have the same size');
end
%if ~isa(X,'double')
% X=double(X)./255.00;
%end
%if ~isa(Y,'double')
% Y=double(Y)./255.00;
%end
% begin
d1=max(X(:));
d2=max(Y(:));
d=max(d1,d2);
sigma=mean2((X-Y).^2);
y=10*log((d.^2)./sigma);
Start testing with this function... BUT i think that this function works well , example :
I=randn(100,100,100);
J=I*0.9;
PSNR_RGB(I,J); % 76 Decibels
J=imnoise(I,'Gaussian',0,0.6);
PSNR_RGB(I,J); % 30 Decibels
  2 Comments
Rawan hamdi
Rawan hamdi on 9 Apr 2013
Thank u so much but does this work for an image of size [280,307,191]?
Youssef  Khmou
Youssef Khmou on 9 Apr 2013
look at the example above, i think it works, otherwise try as i said to download the submission, the psnr for multidimensional array is explained .

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!