Skip to content
DeepForgeby svx
All problems
HardComputer Visioncv-125

Simplified SSIM

Problem

Compute a simplified global structural similarity index between two images.

Use (2 * ma * mb + C1) * (2 * cov + C2) / ((ma^2 + mb^2 + C1) * (va + vb + C2)) with C1 = (0.01 * 255)^2, C2 = (0.03 * 255)^2, and population variances and covariance. Round to 4 decimal places.

Hint

Variance and covariance use division by N (the population form).

Test cases

case 1
in: [[[1,2],[3,4]],[[1,2],[3,4]]]
expected: 1
case 2
in: [[[1,2],[3,4]],[[2,3],[4,5]]]
expected: 0.96
case 3
in: [[[0,0],[0,0]],[[255,255],[255,255]]]
expected: 0.0001
case 4
in: [[[1,2],[3,4]],[[1,1],[3,6]]]
expected: 0.9784
Starter codePython
def simplified_ssim(a, b):
    # Your code here
    pass

4 test cases · run your code against them in the editor