forked from GKalliatakis/Bilateral-Filtering
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPSNR.m
26 lines (20 loc) · 898 Bytes
/
PSNR.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function [out]=PSNR(originalImg,modifiedImg)
%% PSNR of Image Peak signal to noise ratio.
%Peak signal-to-noise ratio is a term for the ratio between the maximum
%possible power of a signal (in our case image)
%and the power of corrupting noise that affects the fidelity of its representation.
%PSNR is an approximation to human perception of reconstruction quality.
% parameters:
% originalImg = Orignal Image
% modifiedImg = Modified Image
% Size of two images must be same.
% Code Developed by :
% Gregory Kalliatakis (December 2014) - [email protected]
% Masters in Computer Vision
% University of Burgundy, France
% Advanced Image Analysis - Homework Project on Bilateral Filtering
originalImg =im2double(originalImg);
modifiedImg =im2double(modifiedImg);
meanSquareError=sum(sum((originalImg-modifiedImg).^2))/(numel(originalImg));
out=10*log10(1/meanSquareError);
end