Table of Contents

NAME

imgdist - calculate the distortion between two images

SYNOPSIS

imgdist [-vo] [-mse] [-snr] [-psnr] [-mae] [-cie] [-m mask] imgfile1 imgfile2

OPTIONS

-vo
Output only the value of the distortion (terse output).
-mse
Express the distortion in terms of MSE.
-snr
Express the distortion in terms of SNR.
-psnr
Express the distortion in terms of PSNR.
-mae
Express the distortion in terms of MAE.
-cie
Express the distortion in terms of an SNR based on the 1964 CIE color distortion measure in the CIE Modified UCS color space. Requires that imgfile1 and imgfile2 be color images.
-m mask
String. Name of file containing the transparency mask for shape-adaptive distortion.

DESCRIPTION

imgdist prints the mean square error (MSE), signal-to-noise ratio (SNR), peak signal-to-noise ratio (PSNR), maximum absolute error (MAE), or CIE-based color SNR between two image files, imgfile1 and imgfile2, to stdout.

The options -mse, -snr, -psnr, -mae, and -cie indicate in which form the distortion should be expressed. If none of these options are specified, imgdist prints the distortion in all forms.

If the option -vo is specified, then imgdist prints a terse output, consisting of only the value of the distortion, to stdout. One of the options -mse, -snr, -psnr, -mae, or -cie must be specified in this case.

For the calculation of SNR and PSNR, imgfile1 is considered to be the original signal; imgdist thus finds the variance of imgfile1 for use in the SNR calculation. For the calculation of PSNR, imgdist assumes that the peak-to-peak range of imgfile1 is 255.

If the image files are color, the MSE, SNR, PSNR, and MAE distortion calculations are performed separately for the Y, U, and V components of the image. The distortions for each image component are output in order. Additionally, for color images, a color SNR distortion based on the 1964 CIE formula for the distance between two colors is calculated (see QccIMGImageColorSNR(3) ).

The distortion calculation can be made "shape-adaptive" by specification of the -m option, in which case mask gives the name of an image file that indicates the transparency mask for the image. mask must be a grayscale image in which black indicates transparency, white indicates full opacity, and gray tones are degrees of translucence (see QccAlpha(3) ). This transparency mask indicates which regions in imgfile1 and imgfile2 are to be taken into consideration in the distortion calculation---pixels that are marked as transparent by mask are ignored and are not included in either the calculation of pixel differences or in the total count of pixels as used in the averaging of the differences. mask must be the same size as both imgfile1 and imgfile2. Note: The CIE-based color SNR distortion cannot be calculated when a mask is specified.

NOTES

Jain defines the SNR in terms of the log of the ratio of the signal variance to the MSE. However, Clarke indicates that, historically, the SNR has not been defined consistently, and describes slightly different variants, including the variance-based definition used by Jain, as well as the log of the ratio of the mean squared signal to the MSE, a definition popular with some other authors. Clarke cautions that one must be sure of the definition of the measure when comparing SNRs as the various definitions yield different values. imgdist follows Jain's definition of a variance-based SNR.

Similarly, there are inconsistent definitions of the PSNR. The most logical definition involves the log of the square of the actual peak-to-peak range of the reference image to the MSE; this is the definition used by Jain. However, the PSNR is now nearly universally accepted as the log of the square of the maximum possible peak-to-peak range allowed by the pixels, a value that depends on the bit-depth of the image pixels and not the reference image itself. For example, an 8-bit image has a possible peak-to-peak range of 255, although the actual range of any given image may be less than this. imgdist calculates PSNR using a peak-to-peak range of 255.

SEE ALSO

QccIMGImageComponentMSE(3) , QccIMGImageComponentMAE(3) , QccIMGImageComponentShapeAdaptiveMSE(3) , QccIMGImageComponentShapeAdaptiveMAE(3) , QccIMGImageColorSNR(3) , QccPackIMG(3) , QccPack(3)

Anil K. Jain, "Fundamentals of Digital Image Processing." Englewood Cliffs, NJ: Prentice Hall, 1989. (See Chapter 3).

Roger J. Clarke, "Digital Compression of Still Images and Video." London: Academic Press Ltd., 1995. (see Section 1.2.7).

AUTHOR

Copyright (C) 1997-2021 James E. Fowler


Table of Contents



Get QccPack at SourceForge.net. Fast, secure and Free Open Source software downloads