Clear Filters
Clear Filters

rgb2lab is returning unexpected results?

1 view (last 30 days)
This is the code I'm running, nothing fancy :
>> rgb2lab([0 1 0],'ColorSpace','sRGB')
ans =
87.7347 -86.1827 83.1793
There must be an argument I'm missing, somewhere (?), because the result does not match all that well what other ICC-aware applications are leading me to believe about the "color appearance" of sRGB Green (RGB = 0 255 0) or [0 1 0], which is CIE Lab 88 -79 81.
87.7341 is perfect but -86.1827 and 83.1793 are not right.
I tried to use arguments like "Adapted White Point" but those are not defined in the function parameters, as far as I can humbly tell.
I tried with cform and applycform but the result is not directly interpretable in CIE Lab, so I can't tell for sure.
(I'll have to figure this one out one of these days, for my own curiosity: I guess the L is expressed on an 8bit 0-255 scale, so that's not the end of the world but the a* and b*? Hmmm. Something about subtracting or adding 128... But that's as far as I'm willing to go... for now)
  2 Comments
Image Analyst
Image Analyst on 16 Dec 2021
What white points are you using? I've let the developers know and they might answer. In the meantime you can
>> edit rgb2lab.m
and see what you can learn though most of the computations are done outside that in a DLL.
Roger Breton
Roger Breton on 16 Dec 2021
That's the "key"!!!!!
To match Photoshop and all other "ICC-based" applications, the white point has to be D50.
Silly me :-)
Now the result is perfect :
>> rgb2lab([0 1 0],'WhitePoint','d50')
ans =
87.8184 -79.2871 80.9893
Thank YOU SO VERY MUCH!!!!!!

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 16 Dec 2021
Set the white point to be D50.
  2 Comments
Roger Breton
Roger Breton on 16 Dec 2021
Never thought of chromatic adaptation... Egg on my face...
Image Analyst
Image Analyst on 16 Dec 2021
Hey, don't feel bad. Everyone makes mistakes. And I've talked to the worlds leading experts in person and even they'll admit they don't know everything. This stuff is confusing even for them - that's why research keeps going on. We don't know everything yet. Because we have physics and optics intertwined with physiology and psychology and anatomical/biological differences, color science is one of the most bewildering fields of science. I'm sure you know lots of things that I don't.

Sign in to comment.

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!