summaryrefslogtreecommitdiffstats
path: root/demos/qualitymetrics.py
blob: 850829e95c9d30f8fdb11e4ae31960d7e6894de4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 21 13:34:32 2018
# quality metrics
@authors: Daniil Kazantsev, Edoardo Pasca
"""
import numpy as np

def nrmse(im1, im2):
    rmse = np.sqrt(np.sum((im2 - im1) ** 2) / float(im1.size))
    max_val = max(np.max(im1), np.max(im2))
    min_val = min(np.min(im1), np.min(im2))
    return 1 - (rmse / (max_val - min_val))
    
def rmse(im1, im2):
    rmse = np.sqrt(np.sum((im1 - im2) ** 2) / float(im1.size))
    return rmse