next up previous contents index
Next: fnorm Up: Reference Previous: fmean   Contents   Index

fmse

$ \bigcirc$Name


fmse Computes the mean square difference between two fimages




$ \bigcirc$Command Synopsis


fmse [-n] [-p] Image1 Image2 . . . .



-n : flag to normalize the images

-p : flag to compute PSNR with max_Image1 - min_Image1 = 255

Image1 : input image #1

Image2 : input image #2

. (screen output) : signal to noise ratio / `Image1` (SNR)

. (screen output) : peak signal to noise ratio / `Image1` (PSNR)

. (screen output) : mean square error between Image1 and Image2 (MSE)

. (screen output) : maximal relative difference (MRD)




$ \bigcirc$Function Summary


void fmse (Img1 , Img2 , Norm , PsnrFlg , SNR , PSNR , MSE , MRD )

Fimage Img1 , Img2 ;

int *Norm ;

char *PsnrFlg ;

double *SNR ;

double *PSNR ;

double *MSE ;

double *MRD ;




$ \bigcirc$Description


fmse computes the maximal relative difference, mean square error, signal to noise ratio, and peak signal to noise ratio between two digitized images whose gray-level values are stored in the files Image1 and Image2.

The maximal relative difference is given by

MRD = 100×$\displaystyle {\frac{{\max_{x,y}\vert f_{1}(x,y) - f_{2}(x,y)\vert}}{{\max_{x,y,i=1,2}f_{i}(x,y) - \min_{x,y,i=1,2}f_{i}(x,y)}}}$

where fi(x, y) is the gray-level value of pixel (x, y) in image i, i = 1, 2.

The mean square error is defined by

MSE = $\displaystyle {\frac{{\sum_{x,y}\vert f_{1}(x,y) - f_{2}(x,y)\vert^{2}}}{{d_{x} \times d_{y}}}}$

where dx and dy are respectively the number of columns and the number of lines in the images.

In maximal relative difference and mean square difference the two images have symetric roles. This is no longer the case in (peak) signal to noise ratio. These quantities can be calculated for any two images, but are more meaningful if f1 is considered as an original image and f2 as an approximation to it. The signal to noise ratio and peak signal to noise ratio are defined as follows

SNR = 10×log10$\displaystyle {\frac{{\sigma_{1}^{2}}}{{MSE}}}$

PSNR = 10×log10$\displaystyle {\frac{{(\max_{x,y}f_{1}(x,y) - \min_{x,y}f_{1}(x,y))^{2}}}{{MSE}}}$

where $ \sigma_{{1}}^{{2}}$ is the empirical variance of the original image.

The -n option specifies that the two images are normalized to 0.0 mean and 1.0 variance before the computation of the quantities listed above.

Using the -p option, you select the following alternative form to compute the peak signal to noise ratio (it should be selected for 8-bits images only):

PSNR = 10×log10$\displaystyle {\frac{{255^{2}}}{{MSE}}}$

.




$ \bigcirc$See Also


amle, fezw, fscalq, fwvq.


$ \bigcirc$Version 1.03


Last Modification date : Thu Nov 29 20:23:56 2001


$ \bigcirc$Author


Jean-Pierre D'Ales, Jacques Froment






next up previous contents index
Next: fnorm Up: Reference Previous: fmean   Contents   Index
mw 2004-05-05