scico.metric#
Image quality metrics and related functions.
Functions
|
Compute Blurred Signal to Noise Ratio (BSNR). |
|
Compute Improvement Signal to Noise Ratio (ISNR). |
|
Compute Mean Absolute Error (MAE) between two images. |
|
Compute Mean Squared Error (MSE) between two images. |
|
Compute Peak Signal to Noise Ratio (PSNR) of two images. |
|
Relative residual of the solution to a linear equation. |
|
Compute Signal to Noise Ratio (SNR) of two images. |
- scico.metric.mae(reference, comparison)[source]#
Compute Mean Absolute Error (MAE) between two images.
- Parameters:
reference (
Union
[Array
,BlockArray
]) – Reference image.comparison (
Union
[Array
,BlockArray
]) – Comparison image.
- Return type:
- Returns:
MAE between reference and comparison.
- scico.metric.mse(reference, comparison)[source]#
Compute Mean Squared Error (MSE) between two images.
- Parameters:
reference (
Union
[Array
,BlockArray
]) – Reference image.comparison (
Union
[Array
,BlockArray
]) – Comparison image.
- Return type:
- Returns:
MSE between reference and comparison.
- scico.metric.snr(reference, comparison)[source]#
Compute Signal to Noise Ratio (SNR) of two images.
- Parameters:
reference (
Union
[Array
,BlockArray
]) – Reference image.comparison (
Union
[Array
,BlockArray
]) – Comparison image.
- Return type:
- 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) orNone
, in which case the actual range of the reference signal is used.
- Return type:
- 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:
reference (
Union
[Array
,BlockArray
]) – Reference image.degraded (
Union
[Array
,BlockArray
]) – Degraded/observed image.restored (
Union
[Array
,BlockArray
]) – Restored/estimated image.
- Return type:
- 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:
blurry (
Union
[Array
,BlockArray
]) – Blurred noise free image.noisy (
Union
[Array
,BlockArray
]) – Blurred image with additive noise.
- Return type:
- 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:
ax (
Union
[BlockArray
,Array
]) – Linear component \(A \mathbf{x}\) of equation.b (
Union
[BlockArray
,Array
]) – Constant component \(\mathbf{b}\) of equation.
- Return type:
- Returns:
Relative residual value.