colour.utilities.metric_psnr

colour.utilities.metric_psnr(a, b, max_a=1)[source]

Computes the peak signal-to-noise ratio (PSNR) between given array_like \(a\) and \(b\) variables.

Parameters:
  • a (array_like) – \(a\) variable.
  • b (array_like) – \(b\) variable.
  • max_a (numeric, optional) – Maximum possible pixel value of the \(a\) variable.
Returns:

Peak signal-to-noise ratio (PSNR).

Return type:

float

References

[Wikipedia2004]

Examples

>>> a = np.array([0.48222001, 0.31654775, 0.22070353])
>>> b = a * 0.9
>>> metric_psnr(a, b)  # doctest: +ELLIPSIS
28.9568515...