PANDORE Version 6 GREYC-IMAGE

ppsnr



Computes the Peak Signal to Noise Ratio.



Synopsis

ppsnr max [im1_in|-] [im2_in|-]

Description

ppsnr measures the Peak Signal to Noise ration between the initial image im_in1 and the restored or enhanced image im_in2.
The Peak Signal to Noise Ratio (PSNR) is the ratio between the maximum possible power of a signal and the power of corrupting noise that affects the fidelity of its representation. It is defined via the mean squared error (MSE) between the two input images where im1_in is the input image and im2_in is the restored or enhanced version of im1_in.
Consequently, the higher is the PSNR, the better is the signal and consequently the related image processing (restoration or enhancement).

Because many signals have a very wide dynamic range, PSNR is expressed in terms of decibel (dB). Typical values for the PSNR in image compression are between 30 and 40 dB.

PSNR is defined as follows:

   PSNR = 10 * log10( (max*max)/MSE);
   with MSE=sum((im_in1-im_in2)2)/N

where max is the maximum pixel value of the input images (not greater than the possible maximum value of the input image) and N is the total number of pixels of the input image. If max=-1 then max=Max(ims_in1)-Min(im_in1)).

Input images im_in1 and im_in2 must have the same dimensions and the same type.

For color images or multispectral images, the definition of PSNR is the same except that the MSE is the sum over all squared value differences divided by image size and by the number of bands (ie. 3 for the color images).

Parameter

Inputs

Result

Returns the ratio value as a positive real value expressed in dB.
(Use pstatus to get this value).

Examples

Adds gaussian noise with mean 0 and standard deviation 1.5 to tangram.pan image and then computes the PSNR for the meanfilter smoothing operator:

   paddnoise 1 0 1.5 tangram.pan a.pan
   pmeanfiltering 2 a.pan i1.pan
   ppsnr 255 tangram.pan i1.pan
   pstatus

See also

Evaluation, pmse, psnr

C++ prototype

Errc PPSNR( const Img2duc &im_in1, const Img2duc &im_in2, Float max );

Version française

Calcul du rapport signal sur bruit en crête.


Author: Régis Clouard