Main Content

xyz2rgbwide

Convert CIE 1931 XYZ color values to wide-gamut RGB color values

Since R2020b

    Description

    RGB = xyz2rgbwide(XYZ,BPS) converts the specified CIE 1931 XYZ color values to wide-gamut RGB values in the BT.2020 or BT.2100 color space. BPS specifies the number of bits required to represent each channel of the output RGB values.

    example

    RGB = xyz2rgbwide(XYZ,BPS,Name=Value) specifies options using one or more name-value pair arguments.

    Examples

    collapse all

    Convert XYZ color values into 10-bit or 12-bit wide-gamut RGB values in the BT.2020/BT.2100 color space.

    Convert XYZ Color into 10-bit BT.2020 RGB Value

    Create an XYZ value.

    xyzvalue = [0.25 0.40 0.10];

    Convert the XYZ value to a 10-bit BT.2020 RGB value.

    rgbvalue = xyz2rgbwide(xyzvalue,10)
    rgbvalue = 1x3 uint16 row vector
    
       504   670   289
    
    

    Convert XYZ Color into 12-bit BT.2100 RGB Value

    Create an XYZ value.

    xyzvalue = [0.25 0.40 0.10];

    Convert the XYZ value to a 12-bit BT.2100 RGB value.

    rgbvalue = xyz2rgbwide(xyzvalue,12,'Colorspace','BT.2100')
    rgbvalue = 1x3 uint16 row vector
    
       2015   2681   1155
    
    

    Convert XYZ Color into 10-bit BT.2100 RGB Value Using HLG

    Create an XYZ value.

    xyzvalue = [0.25 0.40 0.10];

    Convert the XYZ value to a 10-bit BT.2100 RGB value using the Hybrid Log Gamma (HLG) transfer function.

    rgbvalue = xyz2rgbwide(xyzvalue,12,'Colorspace','BT.2100','LinearizationFcn','HLG')
    rgbvalue = 1x3 uint16 row vector
    
       2875   3285   1989
    
    

    Input Arguments

    collapse all

    Color values in the CIE 1931 XYZ color space, specified as one of the following:

    • p-by-3 numeric matrix of color values (one color per row)

    • m-by-n-by-3 numeric array representing an image

    • m-by-n-by-3-by-f numeric array representing a stack of images

    Data Types: single | double

    Bits per sample for each channel of the output wide-gamut RGB image, specified as 10 or 12.

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: rgb = xyz2rgbwide([0.25 0.40 0.10],12,ColorSpace="BT.2100") specifies the color space of the wide-gamut RGB values as "BT.2100".

    Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

    Example: rgb = xyz2rgbwide([0.25 0.40 0.10],12,"ColorSpace","BT.2100") specifies the color space of the wide-gamut RGB values as "BT.2100".

    Color space of the output RGB values, specified as "BT.2020" or "BT.2100".

    Data Types: char | string

    Reference white point, specified as one of the CIE standard illuminants, listed in the table.

    ValueWhite Point
    "a"

    CIE standard illuminant A, [1.0985, 1.0000, 0.3558]. Simulates typical, domestic, tungsten-filament lighting with correlated color temperature of 2856 K.

    "c"CIE standard illuminant C, [0.9807, 1.0000, 1.1822]. Simulates average or north sky daylight with correlated color temperature of 6774 K. Deprecated by CIE.
    "e"Equal-energy radiator, [1.000, 1.000, 1.000]. Useful as a theoretical reference.
    "d50"CIE standard illuminant D50, [0.9642, 1.0000, 0.8251]. Simulates warm daylight at sunrise or sunset with correlated color temperature of 5003 K. Also known as horizon light.

    "d55"

    CIE standard illuminant D55, [0.9568, 1.0000, 0.9214]. Simulates mid-morning or mid-afternoon daylight with correlated color temperature of 5500 K.

    "d65"CIE standard illuminant D65, [0.9504, 1.0000, 1.0888]. Simulates noon daylight with correlated color temperature of 6504 K.
    "icc"Profile Connection Space (PCS) illuminant used in ICC profiles. Approximation of [0.9642, 1.000, 0.8249] using fixed-point, signed, 32-bit numbers with 16 fractional bits. Actual value: [31595,32768, 27030]/32768.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | char | string

    Transfer function for transformation, specified as one of the following values:

    ValueDescription
    "PQ"Perceptual Quantization
    "HLG"Hybrid Log Gamma

    Data Types: char | string

    Output Arguments

    collapse all

    Output RGB color values, returned as a numeric array of the same size as the XYZ input value. The table shows the data range for the wide-gamut color values for 10- and 12-bit data. The minimum value in each range maps to black, and the maximum value in each range maps to white.

    Data TypeFull Data RangeData Range for Wide-Gamut RGB
    10-bit[0, 1023][64, 940]
    12-bit [0, 4095][256, 3760]

    Data Types: uint16

    References

    [1] Rec. ITU-R BT.2020-2 (10/2015). "Parameter values for ultra-high definition television systems for production and international programme exchange." International Telecommunication Union; Broadcasting service (television). https://www.itu.int/rec/R-REC-BT.2020.

    [2] Rec. ITU-R BT.2100-2 (07/2018). "Image parameter values for dynamic range television for use in production and international programme exchange." International Telecommunication Union; Broadcasting service (television). https://www.itu.int/rec/R-REC-BT.2100.

    [3] Rec. ITU-R BT.2390-7 (07/2019). "High dynamic range television for production and international programme exchange." International Telecommunication Union; Broadcasting service (television). https://www.itu.int/pub/R-REP-BT.2390.

    Version History

    Introduced in R2020b