2.1.2.1.3. sf_tools.image.quality module

QUALITY ASSESSMENT ROUTINES

This module contains methods and classes for assessing the quality of image reconstructions.

Author:Samuel Farrens <samuel.farrens@gmail.com>
Version:1.2
Date:20/10/2017

Notes

Some of the methods in this module are based on work by Fred Ngole.

sf_tools.image.quality.nmse(image1, image2, metric=<function mean>)[source]

Normalised Mean Square Error

This method computes the NMSE of two input images, or the result of the input metric on a stack of input images.

Parameters:
  • image1 (np.ndarray) – First image (or stack of images) to be analysed (original image)
  • image2 (np.ndarray) – Second image (or stack of images) to be analysed (reconstructed image)
  • metric (function) – Metric to be apllied to NMSE results (default is ‘np.mean’)
Returns:

Return type:

float NMSE value or metric value(s)

Raises:

ValueError – For invalid input data dimensions

See also

e_error()
ellipticity error

Notes

This method implements the following equation:

  • Equations from [NS2016] sec 4.1:
\[\text{NMSE} = \frac{1}{D}\sum_{i=1}^D \frac{\|\hat{\text{Im}}_i - \text{Im}_i\|_2^2} {\|\text{Im}_i\|_2^2}\]

Examples

>>> from image.quality import nmse
sf_tools.image.quality.e_error(image1, image2, metric=<function mean>)[source]

Normalised Mean Square Error

This method computes the ellipticity error of two input images, or the result of the input metric on the ellipticity values.

Parameters:
  • image1 (np.ndarray) – First image to be analysed (original image)
  • image2 (np.ndarray) – Second image to be analysed (reconstructed image)
  • metric (function) – Metric to be apllied to ellipticity error results (default is ‘np.mean’)
Returns:

Return type:

float ellipticity error value or metric value(s)

Raises:

ValueError – For invalid input data dimensions

See also

nmse()
nmse error

Notes

This method implements the following equation:

  • Equations from [NS2016] sec 4.1:
\[\text{E}_\gamma = \frac{1}{D}\sum_{i=1}^D \|\gamma(\text{Im}_i) - \gamma(\hat{\text{Im}}_i)\|_2\]

Examples

>>> from image.quality import e_error