www.gusucode.com > images 案例代码 matlab源码程序 > images/CalculatePSNRForNoisyImageGivenOriginalImageAsReferenceExample.m
%% Calculate PSNR for Noisy Image Given Original Image as Reference % %% % Read image and create a copy with added noise. The original image is the % reference image. % Copyright 2015 The MathWorks, Inc. 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);