Skip to content
Snippets Groups Projects
Commit 11967285 authored by vpustova's avatar vpustova
Browse files

Upload New File

parent bb9a0c23
Branches
No related tags found
No related merge requests found
function [Metrics] = US_ADM_calc_PSNR(img1,img2)
%% US_ADM_calc_PSNR Calculates the Peak Signal-to-Noise Ratio.
% PSNR = US_ADM_calc_PSNR(img1,img2)
%
% img1: reference image
% img2: output image
%
% ----------------------
% | Code: Renaud Morin |
% | Email: morin@irit.fr |
% | Date: July 2011 |
% ----------------------
%% Initialization
if nargin~=2
error('MATLAB:paramAmbiguous','There must be exactly 2 arguments.')
end
if size(img1)~=size(img2)
error('MATLAB:paramAmbiguous','Inputs must be of same size')
end
%% Process
d= max(abs([img1(:);img2(:)]));
MSE=sum( (img1(:)-img2(:)).^2 )/numel(img1);
MSE1 = MSE;
PSNR=10*log10(d^2/MSE);
RMSE = sqrt(MSE);
MSE = MSE/(sum((img1(:)).^2));
NRMSE = sqrt(MSE*numel(img1));
% assignement
Metrics.MSE=MSE1;
Metrics.PSNR = PSNR;
Metrics.RMSE = RMSE;
Metrics.NRMSE = NRMSE;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment