Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

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

SpatialPack

Tools for Assessment the Association Between Two Spatial Processes

v0.3-8196
GPL-3
Authors
Felipe Osorio [aut, cre] (<https://orcid.org/0000-0002-4675-5201>), Ronny Vallejos [aut] (<https://orcid.org/0000-0001-5519-0946>), Francisco Cuevas [ctb], Diego Mancilla [ctb]
Initial release
2020-09-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.