compare_ssim
-
skimage.measure.compare_ssim(X, Y, win_size=None, gradient=False, dynamic_range=None, multichannel=False, gaussian_weights=False, full=False, **kwargs)
[source] -
Compute the mean structural similarity index between two images.
Parameters: X, Y : ndarray
Image. Any dimensionality.
win_size : int or None
The side-length of the sliding window used in comparison. Must be an odd value. If
gaussian_weights
is True, this is ignored and the window size will depend onsigma
.gradient : bool
If True, also return the gradient.
dynamic_range : int
The dynamic range of the input image (distance between minimum and maximum possible values). By default, this is estimated from the image data-type.
multichannel : int or None
If True, treat the last dimension of the array as channels. Similarity calculations are done independently for each channel then averaged.
gaussian_weights : bool
If True, each patch has its mean and variance spatially weighted by a normalized Gaussian kernel of width sigma=1.5.
full : bool
If True, return the full structural similarity image instead of the mean value
Returns: mssim : float or ndarray
The mean structural similarity over the image.
grad : ndarray
The gradient of the structural similarity index between X and Y [R262]. This is only returned if
gradient
is set to True.S : ndarray
The full SSIM image. This is only returned if
full
is set to True.Other Parameters: use_sample_covariance : bool
if True, normalize covariances by N-1 rather than, N where N is the number of pixels within the sliding window.
K1 : float
algorithm parameter, K1 (small constant, see [R261])
K2 : float
algorithm parameter, K2 (small constant, see [R261])
sigma : float
sigma for the Gaussian when
gaussian_weights
is True.Notes
To match the implementation of Wang et. al. [R261], set
gaussian_weights
to True,sigma
to 1.5, anduse_sample_covariance
to False.References
[R261] (1, 2, 3, 4) 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. https://ece.uwaterloo.ca/~z70wang/publications/ssim.pdf [R262] (1, 2) Avanaki, A. N. (2009). Exact global histogram specification optimized for structural similarity. Optical Review, 16, 613-621. http://arxiv.org/abs/0901.0065
Please login to continue.