python: psnr和ssim计算

psnr 和 ssim计算

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

denoised = np.clip(denoised * 255.0 + 0.5, 0, 255).astype(np.uint8)

temp_psnr = compare_psnr(denoised, gt, data_range=255)
temp_ssim = compare_ssim(denoised, gt, data_range=255, channel_axis=-1)

cv2.imwrite(os.path.join(save_dir, '%s_%.2f_out.png' % (filename, temp_psnr)), denoised)
cv2.imwrite(os.path.join(save_dir, '%s_NOISY.png' % (filename)), noisy)
cv2.imwrite(os.path.join(save_dir, '%s_GT.png' % (filename)), gt)

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