# colour.utilities.metric_psnr#

colour.utilities.metric_psnr(a: ArrayLike, b: ArrayLike, max_a: Number = 1, axis: Optional[Union[int, Tuple[int]]] = None) FloatingOrNDArray[source]#

Compute the peak signal-to-noise ratio (PSNR) between given variables $$a$$ and $$b$$.

Parameters:
• a (ArrayLike) – Variable $$a$$.

• b (ArrayLike) – Variable $$b$$.

• max_a (Number) – Maximum possible pixel value of the $$a$$ variable.

• axis (Optional[Union[int, Tuple[int]]]) – Axis or axes along which the means are computed. The default is to compute the mean of the flattened array. If this is a tuple of ints, a mean is performed over multiple axes, instead of a single axis or all the axes as before.

Returns:

Peak signal-to-noise ratio (PSNR).

Return type:

References

Examples

>>> a = np.array([0.48222001, 0.31654775, 0.22070353])
>>> b = a * 0.9
>>> metric_psnr(a, b)
28.9568515...