scico.metric#

Image quality metrics and related functions.

Functions

bsnr(blurry, noisy)

Compute Blurred Signal to Noise Ratio (BSNR).

isnr(reference, degraded, restored)

Compute Improvement Signal to Noise Ratio (ISNR).

mae(reference, comparison)

Compute Mean Absolute Error (MAE) between two images.

mse(reference, comparison)

Compute Mean Squared Error (MSE) between two images.

psnr(reference, comparison[, signal_range])

Compute Peak Signal to Noise Ratio (PSNR) of two images.

rel_res(ax, b)

Relative residual of the solution to a linear equation.

snr(reference, comparison)

Compute Signal to Noise Ratio (SNR) of two images.

scico.metric.mae(reference, comparison)[source]#

Compute Mean Absolute Error (MAE) between two images.

Parameters:
Return type:

float

Returns:

MAE between reference and comparison.

scico.metric.mse(reference, comparison)[source]#

Compute Mean Squared Error (MSE) between two images.

Parameters:
Return type:

float

Returns:

MSE between reference and comparison.

scico.metric.snr(reference, comparison)[source]#

Compute Signal to Noise Ratio (SNR) of two images.

Parameters:
Return type:

float

Returns:

SNR of comparison with respect to reference.

scico.metric.psnr(reference, comparison, signal_range=None)[source]#

Compute Peak Signal to Noise Ratio (PSNR) of two images.

The PSNR calculation defaults to using the less common definition in terms of the actual range (i.e. max minus min) of the reference signal instead of the maximum possible range for the data type (i.e. \(2^b-1\) for a \(b\) bit representation).

Parameters:
  • reference (Union[Array, BlockArray]) – Reference image.

  • comparison (Union[Array, BlockArray]) – Comparison image.

  • signal_range (Union[int, float, None]) – Signal range, either the value to use (e.g. 255 for 8 bit samples) or None, in which case the actual range of the reference signal is used.

Return type:

float

Returns:

PSNR of comparison with respect to reference.

scico.metric.isnr(reference, degraded, restored)[source]#

Compute Improvement Signal to Noise Ratio (ISNR).

Compute Improvement Signal to Noise Ratio (ISNR) for reference, degraded, and restored images.

Parameters:
Return type:

float

Returns:

ISNR of restored with respect to reference and degraded.

scico.metric.bsnr(blurry, noisy)[source]#

Compute Blurred Signal to Noise Ratio (BSNR).

Compute Blurred Signal to Noise Ratio (BSNR) for a blurred and noisy image.

Parameters:
Return type:

float

Returns:

BSNR of noisy with respect to blurry.

scico.metric.rel_res(ax, b)[source]#

Relative residual of the solution to a linear equation.

The standard relative residual for the linear system \(A \mathbf{x} = \mathbf{b}\) is \(\|\mathbf{b} - A \mathbf{x}\|_2 / \|\mathbf{b}\|_2\). This function computes a variant \(\|\mathbf{b} - A \mathbf{x}\|_2 / \max(\|A\mathbf{x}\|_2, \|\mathbf{b}\|_2)\) that is robust to the case \(\mathbf{b} = 0\).

Parameters:
Return type:

float

Returns:

Relative residual value.