colour.YCbCr_to_RGB

colour.YCbCr_to_RGB(YCbCr, K=array([ 0.2126, 0.0722]), in_bits=8, in_legal=True, in_int=False, out_bits=10, out_legal=False, out_int=False, **kwargs)[source]

Converts an array of Y’CbCr colour encoding values to the corresponding R’G’B’ values array.

Parameters
  • YCbCr (array_like) – Input Y’CbCr colour encoding array of integer or float values.

  • K (array_like, optional) – Luma weighting coefficients of red and blue. See colour.YCBCR_WEIGHTS for presets. Default is (0.2126, 0.0722), the weightings for ITU-R BT.709.

  • in_bits (int, optional) – Bit depth for integer input, 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. Default is 8.

  • in_legal (bool, optional) – Whether to treat the input values as legal range. Default is True.

  • in_int (bool, optional) – Whether to treat the input values as in_bits integer code values. Default is False.

  • 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 False.

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

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

  • out_range (array_like, optional) – Array overriding the computed range such as out_range = (RGB_min, RGB_max). If out_range is undefined, RGB_min and RGB_max will be computed using colour.CV_range() definition.

Returns

R’G’B’ array of integer or float values.

Return type

ndarray

Notes

Domain *

Scale - Reference

Scale - 1

YCbCr

[0, 1]

[0, 1]

Range *

Scale - Reference

Scale - 1

RGB

[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

For Recommendation ITU-R BT.2020, colour.YCbCr_to_RGB() definition is only applicable to the non-constant luminance implementation. colour.YcCbcCrc_to_RGB() definition should be used for the constant luminance case as per [InternationalTUnion15a].

References

[InternationalTUnion11c], [InternationalTUnion15b], [SocietyoMPaTEngineers99], [Wik04e]

Examples

>>> YCbCr = np.array([502, 512, 512])
>>> YCbCr_to_RGB(YCbCr, in_bits=10, in_legal=True, in_int=True)
array([ 0.5,  0.5,  0.5])