SSIM: Structural similarity index

View source: R/similarity.R

SSIMR Documentation

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 documentation built on Sept. 29, 2024, 5:06 p.m.