Structural Similarity (SSIM)ΒΆ
Module for the structural similarity index (SSIM) metric.
Notes
This code is adapted from skimage.metrics.structural_similarity()
available
under [1].
References
Examples
>>> import numpy as np
>>> from viqa import SSIM
>>> img_r = np.zeros((256, 256))
>>> img_m = np.ones((256, 256))
>>> ssim = SSIM(data_range=1, normalize=False)
>>> ssim
SSIM(score_val=None)
>>> score = ssim.score(img_r, img_m)
>>> score
0.0
>>> ssim.print_score()
SSIM: 1.0
>>> img_r = np.zeros((256, 256))
>>> img_m = np.zeros((256, 256))
>>> ssim.score(img_r, img_m)
1.0
>>> img_r = np.random.rand(256, 256)
>>> img_m = np.random.rand(128, 128)
>>> ssim.score(img_r, img_m)
Traceback (most recent call last):
...
ValueError: Image shapes do not match
Functions
|
Compute the structural similarity index between two images. |
Classes
|
Calculate the structural similarity index (SSIM) between two images. |