colour.models.SMPTE_C_COLOURSPACE

colour.models.SMPTE_C_COLOURSPACE = RGB_Colourspace(SMPTE C, [[ 0.63 , 0.34 ], [ 0.31 , 0.595], [ 0.155, 0.07 ]], [ 0.3127, 0.329 ], D65, [[ 0.3935209 , 0.36525808, 0.19167695], [ 0.21237636, 0.70105986, 0.08656378], [ 0.01873909, 0.11193393, 0.95838473]], [[ 3.50600328, -1.73979073, -0.54405827], [-1.06904756, 1.97777888, 0.03517142], [ 0.05630659, -0.19697565, 1.04995233]], functools.partial(<function gamma_function>, exponent=0.45454545454545453), functools.partial(<function gamma_function>, exponent=2.2), False, False)

Implements support for the RGB colourspaces datasets from colour.models.datasets.aces_rgb, etc….

Colour science literature related to RGB colourspaces and encodings defines their dataset using different degree of precision or rounding. While instances where a whitepoint is being defined with a value different than its canonical agreed one are rare, it is however very common to have normalised primary matrices rounded at different decimals. This can yield large discrepancies in computations.

Such an occurrence is the V-Gamut colourspace white paper, that defines the V-Gamut to ITU-R BT.709 conversion matrix as follows:

[[ 1.806576 -0.695697 -0.110879]
 [-0.170090  1.305955 -0.135865]
 [-0.025206 -0.154468  1.179674]]

Computing this matrix using ITU-R BT.709 colourspace derived normalised primary matrix yields:

[[ 1.8065736 -0.6956981 -0.1108786]
 [-0.1700890  1.3059548 -0.1358648]
 [-0.0252057 -0.1544678  1.1796737]]

The latter matrix is almost equals with the former, however performing the same computation using IEC 61966-2-1:1999 sRGB colourspace normalised primary matrix introduces severe disparities:

[[ 1.8063853 -0.6956147 -0.1109453]
 [-0.1699311  1.3058387 -0.1358616]
 [-0.0251630 -0.1544899  1.1797117]]

In order to provide support for both literature defined dataset and accurate computations enabling transformations without loss of precision, the colour.RGB_Colourspace class provides two sets of transformation matrices:

  • Instantiation transformation matrices
  • Derived transformation matrices

Upon instantiation, the colour.RGB_Colourspace class stores the given RGB_to_XYZ_matrix and XYZ_to_RGB_matrix arguments and also computes their derived counterpart using the primaries and whitepoint arguments.

Whether the initialisation or derived matrices are used in subsequent computations is dependent on the colour.RGB_Colourspace.use_derived_RGB_to_XYZ_matrix and colour.RGB_Colourspace.use_derived_XYZ_to_RGB_matrix attributes values.

Parameters:
  • name (unicode) – RGB colourspace name.
  • primaries (array_like) – RGB colourspace primaries.
  • whitepoint (array_like) – RGB colourspace whitepoint.
  • whitepoint_name (unicode, optional) – RGB colourspace whitepoint name.
  • RGB_to_XYZ_matrix (array_like, optional) – Transformation matrix from colourspace to CIE XYZ tristimulus values.
  • XYZ_to_RGB_matrix (array_like, optional) – Transformation matrix from CIE XYZ tristimulus values to colourspace.
  • cctf_encoding (object, optional) – Encoding colour component transfer function (Encoding CCTF) / opto-electronic transfer function (OETF / OECF) that maps estimated tristimulus values in a scene to \(R'G'B'\) video component signal value.
  • cctf_decoding (object, optional) – Decoding colour component transfer function (Decoding CCTF) / electro-optical transfer function (EOTF / EOCF) that maps an \(R'G'B'\) video component signal value to tristimulus values at the display.
  • use_derived_RGB_to_XYZ_matrix (bool, optional) – Whether to use the instantiation time normalised primary matrix or to use a computed derived normalised primary matrix.
  • use_derived_XYZ_to_RGB_matrix (bool, optional) – Whether to use the instantiation time inverse normalised primary matrix or to use a computed derived inverse normalised primary matrix.
colour.models.name
colour.models.primaries
colour.models.whitepoint
colour.models.whitepoint_name
colour.models.RGB_to_XYZ_matrix
colour.models.XYZ_to_RGB_matrix
colour.models.cctf_encoding[source]
colour.models.cctf_decoding[source]
colour.models.use_derived_RGB_to_XYZ_matrix
colour.models.use_derived_XYZ_to_RGB_matrix
colour.models.__str__()
colour.models.__repr__()
colour.models.use_derived_transformation_matrices()
colour.models.chromatically_adapt()
colour.models.copy()

Notes

  • The normalised primary matrix defined by colour.RGB_Colourspace.RGB_to_XYZ_matrix attribute is treated as the prime matrix from which the inverse will be calculated as required by the internal derivation mechanism. This behaviour has been chosen in accordance with literature where commonly a RGB colourspace is defined by its normalised primary matrix as it is directly computed from the chosen primaries and whitepoint.

References

[InternationalElectrotechnicalCommission1999a], [Panasonic2014a]

Examples

>>> p = np.array([0.73470, 0.26530, 0.00000, 1.00000, 0.00010, -0.07700])
>>> whitepoint = np.array([0.32168, 0.33767])
>>> RGB_to_XYZ_matrix = np.identity(3)
>>> XYZ_to_RGB_matrix = np.identity(3)
>>> colourspace = RGB_Colourspace('RGB Colourspace', p, whitepoint, 'ACES',
...                               RGB_to_XYZ_matrix, XYZ_to_RGB_matrix)
>>> colourspace.RGB_to_XYZ_matrix
array([[ 1.,  0.,  0.],
       [ 0.,  1.,  0.],
       [ 0.,  0.,  1.]])
>>> colourspace.XYZ_to_RGB_matrix
array([[ 1.,  0.,  0.],
       [ 0.,  1.,  0.],
       [ 0.,  0.,  1.]])
>>> colourspace.use_derived_transformation_matrices(True)
True
>>> colourspace.RGB_to_XYZ_matrix  # doctest: +ELLIPSIS
array([[  9.5255239...e-01,   0.0000000...e+00,   9.3678631...e-05],
       [  3.4396645...e-01,   7.2816609...e-01,  -7.2132546...e-02],
       [  0.0000000...e+00,   0.0000000...e+00,   1.0088251...e+00]])
>>> colourspace.XYZ_to_RGB_matrix  # doctest: +ELLIPSIS
array([[  1.0498110...e+00,   0.0000000...e+00,  -9.7484540...e-05],
       [ -4.9590302...e-01,   1.3733130...e+00,   9.8240036...e-02],
       [  0.0000000...e+00,   0.0000000...e+00,   9.9125201...e-01]])
>>> colourspace.use_derived_RGB_to_XYZ_matrix = False
>>> colourspace.RGB_to_XYZ_matrix
array([[ 1.,  0.,  0.],
       [ 0.,  1.,  0.],
       [ 0.,  0.,  1.]])
>>> colourspace.use_derived_XYZ_to_RGB_matrix = False
>>> colourspace.XYZ_to_RGB_matrix
array([[ 1.,  0.,  0.],
       [ 0.,  1.,  0.],
       [ 0.,  0.,  1.]])