From 61bfe1f57fbda958e24e227e567676fafd7f6d3e Mon Sep 17 00:00:00 2001 From: Tomas Kulhanek Date: Thu, 21 Feb 2019 02:11:13 -0500 Subject: restructured sources --- docs/demos/qualitymetrics.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 docs/demos/qualitymetrics.py (limited to 'docs/demos/qualitymetrics.py') diff --git a/docs/demos/qualitymetrics.py b/docs/demos/qualitymetrics.py new file mode 100644 index 0000000..850829e --- /dev/null +++ b/docs/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 -- cgit v1.2.3