colour.YCbCr_to_RGB#
- colour.YCbCr_to_RGB(YCbCr: ArrayLike, K: NDArrayFloat = WEIGHTS_YCBCR['ITU-R BT.709'], in_bits: int = 8, in_legal: bool = True, in_int: bool = False, out_bits: int = 10, out_legal: bool = False, out_int: bool = False, clamp_int: bool = True, **kwargs: Any) NDArrayReal [source]#
Convert an array of Y’CbCr colour encoding values to the corresponding R’G’B’ values array.
- Parameters:
YCbCr (ArrayLike) – Input Y’CbCr colour encoding array of int or float values.
K (NDArrayFloat) – Luma weighting coefficients of red and blue. See
colour.WEIGHTS_YCBCR
for presets. Default is (0.2126, 0.0722), the weightings for ITU-R BT.709.in_bits (int) – Bit-depth for int 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) – Whether to treat the input values as legal range. Default is True.
in_int (bool) – Whether to treat the input values as
in_bits
int code values. Default is False.out_bits (int) – Bit-depth for int 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
andout_int
are both False. Default is 10.out_legal (bool) – Whether to return legal range values. Default is False.
out_int (bool) – Whether to return values as
out_bits
int code values. Default is False.clamp_int (bool) – Whether to clamp int output to allowable range for
out_bits
. Default is True.in_range – 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 usingcolour.models.rgb.ycbcr.ranges_YCbCr()
definition.out_range – 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 usingcolour.CV_range()
definition.kwargs (Any)
- Returns:
R’G’B’ array of int or float values.
- Return type:
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 int 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], [Wikipedia04e]
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])