Approximation quality metrics
[PSNR,MSE,MAXERR,L2RAT]
= measerr(X,XAPP)
[...] = measerr(...,BPS)
[
returns
the peak signaltonoise ratio, PSNR
,MSE
,MAXERR
,L2RAT
]
= measerr(X
,XAPP
)PSNR
, mean square
error, MSE
, maximum squared error, MAXERR
,
and ratio of squared norms, L2RAT
, for an input
signal or image, X
, and its approximation, XAPP
.
[...] = measerr(...,
uses
the bits per sample, BPS
)BPS
, to determine the peak
signaltonoise ratio.





Default: 8 



The mean square error (MSE) is the squared norm of the difference between the data and the approximation divided by the number of elements. 




Approximate an image and calculate approximation quality metrics.
load woman; Xapp = X; Xapp(X<=50) = 1; [psnr,mse,maxerr,L2rat] = measerr(X,Xapp); figure; colormap(map); subplot(1,2,1); image(X); subplot(1,2,2); image(Xapp);
Measure approximation quality in an RGB image.
X = imread('africasculpt.jpg'); Xapp = X; Xapp(X<=100) = 1; [psnr,mse,maxerr,L2rat] = measerr (X,Xapp) figure; subplot(1,2,1); image(X); subplot(1,2,2); image(Xapp);
HuynhThu, Q.Scope of validity of PSNR in image/video quality assessment, Electronics Letters, 44, 2008, pp. 800–801.