colour.characterisation.colour_correction_Cheung2004

colour.characterisation.colour_correction_Cheung2004(RGB, M_T, M_R, terms=3)[source]

Performs colour correction of given RGB colourspace array using the colour correction matrix from given \(M_T\) colour array to \(M_R\) colour array using Cheung et al. (2004) method.

Parameters:
  • RGB (array_like, (n, 3)) – RGB colourspace array to colour correct.
  • M_T (array_like, (n, 3)) – Test array \(M_T\) to fit onto array \(M_R\).
  • M_R (array_like, (n, 3)) – Reference array the array \(M_T\) will be colour fitted against.
  • terms (int, optional) – Number of terms of the expanded polynomial, must be one of [3, 5, 7, 8, 10, 11, 14, 16, 17, 19, 20, 22].
Returns:

Colour corrected RGB colourspace array.

Return type:

ndarray

References

[Cheung2004], [Westland2004]

Examples

>>> RGB = np.array([0.17224810, 0.09170660, 0.06416938])
>>> prng = np.random.RandomState(2)
>>> M_T = prng.random_sample((24, 3))
>>> M_R = M_T + (prng.random_sample((24, 3)) - 0.5) * 0.5
>>> colour_correction_Cheung2004(RGB, M_T, M_R)  # doctest: +ELLIPSIS
array([ 0.1793456...,  0.1003392...,  0.0617218...])