TransWikia.com

Confused about D50/D65 conversion going from Lab to sRGB color spaces

Photography Asked by bekoch on October 1, 2021

I am writing code for some color conversion work and have a confusion. My purpose for this conversion is to get the colors look reasonably correct in a typical non-professional display (PC, tablet etc) when I save as png or jpeg for example.

Here are my steps:

  • I utilize a color calibration target (ISA ColorChecker) with reference values provided by the manufacturer in Lab space with D50 white point.
  • I capture a raw image of the target and demosaic the Bayer pattern arriving at RawRGB values for each of the Calibration Target’s patches (average value is taken). To calculate a color correction matrix, I want to find the (not-gamma-corrected) sRGB values starting from the Lab reference values of the Target.
  • I use the formulas in http://www.brucelindbloom.com. First step is going from Lab to XYZ I use the D50 white reference point XYZReference = 0.9642,1.0000,0.8251
  • Second step is going from XYZ to sRGB and this is where the confusion is: I arrived at the XYZ values using a D50 white point, but sRGB with D65 illuminant is the most common working color space of consumer displays. Which of the inverseM matrices shall I be using to get this right?

After the linear conversion above, I know that I must also apply the gamma-companding.

Thank you!

One Answer

Which of the inverseM matrices shall I be using to get this right?

Use the sRGB, Bradford adapted inversion matrix: XYZ to RGB [M]-1

3.1338561 -1.6168667 -0.4906146
-.9787684  1.9161415  0.0334540
0.0719453 -0.2289914  1.4052427

This is used because everything involved in converting from/to L*a*b* and sRGB uses D50 even though D65 is the presumed display's white point. ICC profiles use D50 as the common reference white and primary chromaticity values in the ICC profiles are already adapted to D50. So D65 can be ignored.

Using L*a*b* 50 for the middle gray Colorchecker(tm) square, Conversion to XYZ should yield: XYZ=(0.177596 0.184187 0.151993) which is about 18% of D50 white.

Multiplying the inverting matrix M, with XYZ yields the sRGB value in linear gamma: RGB=(.184,.184,.184) which is expected. Note R=G=B and they are just above 18% reflectance which is L*50.

A good crosscheck is the BruceLindbloom calculator as shown here. Note gamma has been changed from sRGB's standard, modified 2.2 gamma to 1.0. If you wish to save the RGB values properly the sRGB gamma should be applied. You can also use the calculator to check your gamma algorithm if you pursue doing this.

enter image description here

Answered by doug on October 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP