You are here : matlabImage Processingpsnr

psnr() - Image Processing

peaksnr = psnr(A,ref) calculates
the peak signal-to-noise ratio for     the image A,
with the image ref as the reference. A and ref must
be of the same size and class.peaksnr = psnr(A,ref,peakval) uses peakval as
the peak signal value for calculating the peak signal-to-noise ratio
for image A. [peaksnr,snr]
= psnr(___) returns the simple signal-to-noise
ratio, snr, in addition to the peak signal-to-noise
ratio.Code Generation support:
Yes.MATLAB Function Block support:


peaksnr = psnr(A,ref) examplepeaksnr = psnr(A,ref,peakval)[peaksnr,snr]
= psnr(___)


Calculate PSNR for Noisy Image Given Original Image as ReferenceOpen This Example
Read image and create a copy with added noise. The original image is the reference image.ref = imread('pout.tif');
A = imnoise(ref,'salt & pepper', 0.02);
Calculate the PSNR.[peaksnr, snr] = psnr(A, ref);

fprintf('\n The Peak-SNR value is %0.4f', peaksnr);
fprintf('\n The SNR value is %0.4f \n', snr);

 The Peak-SNR value is 22.6437
 The SNR value is 15.5524

Output / Return Value


Alternatives / See Also