SpatialPack (version 0.3-8196)

SSIM: Structural similarity index

Description

This function computes the structural similarity index (SSIM) proposed by Wang et al. (2004).

Usage

SSIM(x, y, alpha = 1, beta = 1, gamma = 1, eps = c(0.01, 0.03), L = 255)

Arguments

x

reference image matrix (grayscale)

y

distorted image matrix (grayscale)

alpha

weight associated with luminance, default value is alpha = 1.

beta

weight associated with contrast, default value is beta = 1.

gamma

weight associated with structure, default value is gamma = 1.

eps

rescaling constants, by default eps = c(0.01, 0.03)

L

dynamic range of the images, by default L = 255.

Value

A list containing the following components:

SSIM

structural similarity index between images x and y.

coefficients

weights (alpha, beta, gamma) associated with each component of SSIM

comps

components of SSIM, that is luminance, contrast and structure

stats

sample statistics (means, variances and covariance) for each image.

speed

Running time taken by the procedure.

References

Wang, Z., Bovik, A.C. (2002). A universal image quality index. IEEE Signal Processing Letters 9, 81-84.

Wang, Z., Bovik, A.C., Sheikh, H.R., Simoncelli, E.P. (2004). Image quality assessment: From error visibility to structural similarity. IEEE Transactions on Image Processing 13, 600-612.

Examples

Run this code
# NOT RUN {
data(texmos2)

y <- imnoise(texmos2, type = "gaussian")
plot(as.raster(y))
o <- SSIM(texmos2, y)
o

y <- imnoise(texmos2, type = "speckle")
plot(as.raster(y))
o <- SSIM(texmos2, y)
o
# }

Run the code above in your browser using DataLab