Reputation: 1551
I am confused about some aspects of RGB color space. I am working on tool which helps in converting colors in different color-spaces (targeted to digital graphics). One of the important feature I want to implement is converting colors from RGB to CIE-Lab. After reading multiple articles, it is obvious that first I have to convert RGB to XYZ and then XYZ to Lab. There are plenty of website which have mentioned math behind these conversions. Most notably, Lindbloom's website. This website has provided matrices which can be used for direct conversion between multiple RGB color spaces.
Now, I am confused about which matrix to use. In the context of digital graphics/visualization, RGB means linear-RGB (right?). If someone provides me (r, g, b) values, I will use one of these conversion matrix and calculate X, Y, Z. But my question is which matrix to use? My guess was 'srgb' with 'D65' as a white reference, but I am not sure about it. Any hints towards which matrix to use when user provides linear-RGB?
I know I can convert sRGB to RGB by applying gamma transformation but I am confused about these conversion matrices.
Upvotes: 1
Views: 645
Reputation: 4090
In the context of digital graphics/visualization, RGB means linear-RGB (right?).
RGB is a colour model, a way to specify colour information using RGB components, it is a linear model intrinsically indeed but you cannot really make that assumption safely and must know what the RGB values you are manipulating are representing. There are many RGB flavours, i.e. RGB colourspaces, here is a list of the most common ones:
['ACES2065-1', 'ACEScc', 'ACEScct', 'ACESproxy', 'ACEScg', 'Adobe RGB (1998)', 'Adobe Wide Gamut RGB', 'Apple RGB', 'ALEXA Wide Gamut', 'Best RGB', 'Beta RGB', 'ITU-R BT.470 - 525', 'ITU-R BT.470 - 625', 'ITU-R BT.709', 'ITU-R BT.2020', 'CIE RGB', 'Cinema Gamut', 'ColorMatch RGB', 'DCDM XYZ', 'DCI-P3', 'DCI-P3+', 'Display P3', 'DJI D-Gamut', 'Don RGB 4', 'ECI RGB v2', 'Ekta Space PS 5', 'FilmLight E-Gamut', 'Protune Native', 'Max RGB', 'P3-D65', 'Pal/Secam', 'REDcolor', 'REDcolor2', 'REDcolor3', 'REDcolor4', 'REDWideGamutRGB', 'DRAGONcolor', 'DRAGONcolor2', 'ROMM RGB', 'RIMM RGB', 'ERIMM RGB', 'F-Gamut', 'ProPhoto RGB', 'Russell RGB', 'Sharp RGB', 'SMPTE 240M', 'SMPTE C', 'NTSC (1953)', 'NTSC (1987)', 'S-Gamut', 'S-Gamut3', 'S-Gamut3.Cine', 'Venice S-Gamut3', 'Venice S-Gamut3.Cine', 'sRGB', 'V-Gamut', 'Xtreme RGB']
Each one of them is specified by three components:
Quoting the ISO 22028-1 Standard definition of an additive RGB colourspace in its entirety for reference:
3.3
additive RGB colour space
colorimetric colour space having three colour primaries (generally red, green and blue) such that CIE XYZ tristimulus values can be determined from the RGB colour space values by forming a weighted combination of the CIE XYZ tristimulus values for the individual colour primaries, where the weights are proportional to the radio-metrically linear colour space values for the corresponding colour primaries
Note 1 to entry: A simple linear 3 × 3 matrix transformation can be used to transform between CIE XYZ tristimulus values and the radio-metrically linear colour space values for an additive RGB colour space.
Note 2 to entry: Additive RGB colour spaces are defined by specifying the CIE chromaticity values for a set of additive RGB primaries and a colour space white point, together with a colour component transfer function.
The Normalised Primary Matrix converting from RGB to CIE XYZ is computed using the primaries and the whitepoint. With that in mind, in order to know which matrix you need to use, you need to know which RGB colourspace, i.e. which flavour of RGB your values are encoded with in the first place.
Here is a post that was written a few years ago explaining some of the important aspects of what makes an RGB colourspace: https://www.colour-science.org/posts/the-importance-of-terminology-and-srgb-uncertainty/
Upvotes: 2