Structural Similarity Index (SSIM) for measuring image quality

`___ = ssim(`

computes the SSIM, using name-value pairs to control aspects of the
computation.`A`

,`ref`

,`Name,Value`

)

The Structural Similarity (SSIM) Index quality assessment index is based on the computation of three terms, namely the luminance term, the contrast term and the structural term. The overall index is a multiplicative combination of the three terms.

$$SSIM(x,y)={[l(x,y)]}^{\alpha}\cdot {[c(x,y)]}^{\beta}\cdot {[s(x,y)]}^{\gamma}$$

where

$$\begin{array}{l}l(x,y)=\frac{2{\mu}_{x}{\mu}_{y}+{C}_{1}}{{\mu}_{x}^{2}+{\mu}_{y}^{2}+{C}_{1}},\\ c(x,y)=\frac{2{\sigma}_{x}{\sigma}_{y}+{C}_{2}}{{\sigma}_{x}^{2}+{\sigma}_{y}^{2}+{C}_{2}},\\ s(x,y)=\frac{{\sigma}_{xy}+{C}_{3}}{{\sigma}_{x}{\sigma}_{y}+{C}_{3}}\end{array}$$

where μ_{x}, μ_{y},
σ_{x},σ_{y}, and σ_{xy}
are the local means, standard deviations, and cross-covariance for images *x,
y*. If α = β = γ = 1 (the default for `Exponents`

), and
C_{3} = C_{2}/2 (default selection of
C_{3}) the index simplifies to:

$$SSIM(x,y)=\frac{(2{\mu}_{x}{\mu}_{y}+{C}_{1})(2{\sigma}_{xy}+{C}_{2})}{({\mu}_{x}^{2}+{\mu}_{y}^{2}+{C}_{1})({\sigma}_{x}^{2}+{\sigma}_{y}^{2}+{C}_{2})}$$

[1] Zhou, W., A. C. Bovik, H. R. Sheikh, and E. P. Simoncelli. "Image
Qualifty Assessment: From Error Visibility to Structural Similarity." *IEEE
Transactions on Image Processing*. Vol. 13, Issue 4, April 2004, pp.
600–612.