python图像质量的评估|PSNR与SSIM的计算

参考博客Skimage.measure 的compare_psnr和compare_ssim的改动

from skimage.metrics import structural_similarity as compare_ssim
from skimage.metrics import peak_signal_noise_ratio as compare_psnr

import cv2

img1 = cv2.imread(r'HanJie-20220524-102819-Ping-10260.jpg')
img2 = cv2.imread(r'result.jpg')

psnr = compare_psnr(img1, img2)
ssim = compare_ssim(img1, img2, multichannel=True)  # 对于多通道图像(RGB、HSV等)关键词multichannel要设置为True
#mse = compare_mse(img1, img2)

print('PSNR:{},SSIM:{}'.format(psnr, ssim))

运行结果:
在这里插入图片描述

你可能感兴趣的:(图像处理,python,计算机视觉,opencv)