colour.RGB_to_YcCbcCrc

colour.RGB_to_YcCbcCrc(RGB, out_bits=10, out_legal=True, out_int=False, is_12_bits_system=False, **kwargs)[source]

Converts an array of RGB linear values to the corresponding Yc’Cbc’Crc’ colour encoding values array.

Parameters
  • RGB (array_like) – Input RGB array of linear float values.

  • out_bits (int, optional) – Bit depth for integer output, or used in the calculation of the denominator for legal range float values, i.e. 8-bit means the float value for legal white is 235 / 255. Ignored if out_legal and out_int are both False. Default is 10.

  • out_legal (bool, optional) – Whether to return legal range values. Default is True.

  • out_int (bool, optional) – Whether to return values as out_bits integer code values. Default is False.

  • is_12_bits_system (bool, optional) – Recommendation ITU-R BT.2020 OETF (OECF) adopts different parameters for 10 and 12 bit systems. Default is False.

Other Parameters

out_range (array_like, optional) – Array overriding the computed range such as out_range = (Y_min, Y_max, C_min, C_max). If out_range is undefined, Y_min, Y_max, C_min and C_max will be computed using colour.models.rgb.ycbcr.YCbCr_ranges() definition.

Returns

Yc’Cbc’Crc’ colour encoding array of integer or float values.

Return type

ndarray

Notes

Domain *

Scale - Reference

Scale - 1

RGB

[0, 1]

[0, 1]

Range *

Scale - Reference

Scale - 1

YcCbcCrc

[0, 1]

[0, 1]

* This definition has input and output integer switches, thus the domain-range scale information is only given for the floating point mode.

Warning

This definition is specifically for usage with Recommendation ITU-R BT.2020 when adopting the constant luminance implementation.

References

[InternationalTUnion15a], [Wikipedia04e]

Examples

>>> RGB = np.array([0.18, 0.18, 0.18])
>>> RGB_to_YcCbcCrc(RGB, out_legal=True, out_bits=10, out_int=True,
...                 is_12_bits_system=False)
... 
array([422, 512, 512]...)