1. SSIM: Structural similarity
2. PSNR: Peak Signal to Nosie Ratio
3. implement
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import skimage
from skimage.metrics import structural_similarity as ssim
import numpy as np
from PIL import Image
im1 = Image.open('./uw1.png')
im2 = Image.open('./gt1.png')
im1 = np.array(im1)
im2 = np.array(im2)
# diff = im1 - im2
# mse = np.mean(np.square(diff))
# psnr = 10 * np.log10(255 * 255 / mse)
# print(psnr)
pnsr = skimage.metrics.peak_signal_noise_ratio(im1, im2, data_range=255)
ssim = skimage.metrics.structural_similarity(im1, im2, data_range=255, multichannel=True)
print(psnr, ssim)