diff options
author | Tomas Kulhanek <tomas.kulhanek@stfc.ac.uk> | 2019-02-22 06:44:53 -0500 |
---|---|---|
committer | Tomas Kulhanek <tomas.kulhanek@stfc.ac.uk> | 2019-02-22 06:44:53 -0500 |
commit | 4505a79103e98adb33bfb4c10391319e56ae7031 (patch) | |
tree | 391e8ac544dc152bd9da8295a2446449764db6df /demos/qualitymetrics.py | |
parent | c8a60f57df5a019b2b7295933dc0299d88f1e35c (diff) | |
download | regularization-4505a79103e98adb33bfb4c10391319e56ae7031.tar.gz regularization-4505a79103e98adb33bfb4c10391319e56ae7031.tar.bz2 regularization-4505a79103e98adb33bfb4c10391319e56ae7031.tar.xz regularization-4505a79103e98adb33bfb4c10391319e56ae7031.zip |
UPDATE: docs -> demos and update paths in m and py demos
Diffstat (limited to 'demos/qualitymetrics.py')
-rw-r--r-- | demos/qualitymetrics.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/demos/qualitymetrics.py b/demos/qualitymetrics.py new file mode 100644 index 0000000..850829e --- /dev/null +++ b/demos/qualitymetrics.py @@ -0,0 +1,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 |