sporco.metric¶
Image quality metrics and related functions
Note that the well-known SSIM metric is not implemented here as it is available in a number of other Python packages, including:
Some implementations are also available in unpackaged collections of Python code:
Functions
|
Compute Mean Absolute Error (MAE) between two images. |
|
Compute Mean Squared Error (MSE) between two images. |
|
Compute Signal to Noise Ratio (SNR) of two images. |
|
Compute Peak Signal to Noise Ratio (PSNR) of two images. |
|
Compute Improvement Signal to Noise Ratio (ISNR) for reference, degraded, and restored images. |
|
Compute Blurred Signal to Noise Ratio (BSNR) for a blurred and noisy image. |
|
Compute Perceptual-fidelity Aware Mean Squared Error (PAMSE) IQA metric [61]. |
|
Compute Gradient Magnitude Similarity Deviation (GMSD) IQA metric [62]. |
Function Descriptions¶
- sporco.metric.mae(vref, vcmp)[source]¶
Compute Mean Absolute Error (MAE) between two images.
- Parameters:
- vrefarray_like
Reference image
- vcmparray_like
Comparison image
- Returns:
- xfloat
MAE between vref and vcmp
- sporco.metric.mse(vref, vcmp)[source]¶
Compute Mean Squared Error (MSE) between two images.
- Parameters:
- vrefarray_like
Reference image
- vcmparray_like
Comparison image
- Returns:
- xfloat
MSE between vref and vcmp
- sporco.metric.snr(vref, vcmp)[source]¶
Compute Signal to Noise Ratio (SNR) of two images.
- Parameters:
- vrefarray_like
Reference image
- vcmparray_like
Comparison image
- Returns:
- xfloat
SNR of vcmp with respect to vref
- sporco.metric.psnr(vref, vcmp, rng=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:
- vrefarray_like
Reference image
- vcmparray_like
Comparison image
- rngNone or int, optional (default 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
- Returns:
- xfloat
PSNR of vcmp with respect to vref
- sporco.metric.isnr(vref, vdeg, vrst)[source]¶
Compute Improvement Signal to Noise Ratio (ISNR) for reference, degraded, and restored images.
- Parameters:
- vrefarray_like
Reference image
- vdegarray_like
Degraded image
- vrstarray_like
Restored image
- Returns:
- xfloat
ISNR of vrst with respect to vref and vdeg
- sporco.metric.bsnr(vblr, vnsy)[source]¶
Compute Blurred Signal to Noise Ratio (BSNR) for a blurred and noisy image.
- Parameters:
- vblrarray_like
Blurred noise free image
- vnsyarray_like
Blurred image with additive noise
- Returns:
- xfloat
BSNR of vnsy with respect to vblr and vdeg
- sporco.metric.pamse(vref, vcmp, rescale=True)[source]¶
Compute Perceptual-fidelity Aware Mean Squared Error (PAMSE) IQA metric [61]. This implementation is a translation of the reference Matlab implementation provided by the authors of [61].
- Parameters:
- vrefarray_like
Reference image
- vcmparray_like
Comparison image
- rescalebool, optional (default True)
Rescale inputs so that vref has a maximum value of 255, as assumed by reference implementation
- Returns:
- scorefloat
PAMSE IQA metric
- sporco.metric.gmsd(vref, vcmp, rescale=True, returnMap=False)[source]¶
Compute Gradient Magnitude Similarity Deviation (GMSD) IQA metric [62]. This implementation is a translation of the reference Matlab implementation provided by the authors of [62].
- Parameters:
- vrefarray_like
Reference image
- vcmparray_like
Comparison image
- rescalebool, optional (default True)
Rescale inputs so that vref has a maximum value of 255, as assumed by reference implementation
- returnMapbool, optional (default False)
Flag indicating whether quality map should be returned in addition to scalar score
- Returns:
- scorefloat
GMSD IQA metric
- quality_mapndarray
Quality map