?? psnr.m
字號:
%PSNR.m
function S=PSNR(I,J)
% PSNR(I,J) returns the peak signal to noise ratio) between I and J %(dB)
% I is the original image and J is a modified version of I.
% The PSNR value is useful to calculate the distortions on an image.
if (size(I)~=size(J))
error('Las imagenes deben tener el mismo tama駉')
end
if (~isrgb(I) & ~isrgb(J))
[m n] = size(I);
A=double(I);
B=double(J);
sumaDif=0;
maxI=m*n*max(max(A.^2));
for u=1:m
for v=1:n
sumaDif = sumaDif + (A(u,v)-B(u,v))^2;
end
end
if (sumaDif==0)
sumaDif=1;
end
S=maxI/sumaDif;
S=10*log10(S);
else
error('Las imagenes no pueden ser en color')
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -