a and b channels in CIELAB color space
2 views (last 30 days)
Show older comments
MatlabUser
on 28 Apr 2021
Commented: Image Analyst
on 29 Apr 2021
I am trying to convert an image from RGB (uint8,uint16) to LAB color space , I want to rescale it to [0 1] based on the max and min value of the color space not the image itself.. I would like to know the range that is used when I use rgb2lab..
in the documentation, it is mentioned that it can be [-100, 100] or [-128, 127) for a* and b* channels,
the question is how to know which one is used so I can use it and why these two different ranges??
ref: https://www.mathworks.com/help/images/ref/rgb2lab.html
Any references or explanation will be appreciated,
0 Comments
Accepted Answer
Image Analyst
on 28 Apr 2021
There is no max and min for the colorspace. a and b do not have defined range, like L (which represents percent reflectivity). I don't believe there is any need for you to rescale your a and b images. Why do you want to do that?
4 Comments
Image Analyst
on 29 Apr 2021
I don't believe you need to do that, though you can. That is necessary if for example one of your features is in the range of 1 million to 2 million, and another feature ranges from 0.01 to 0.1 - several orders of magnitude different such that you'd have a problem with truncation or roundoff errors. You don't have that situation. Yours are all in the range of -100 to +100 or so, which is not disparate enough to cause the problem. I don't see that normalization would be needed. That said, if you still insist on using it, you can call rescale on each column before doing kmeans on it, then undo the scaling on the centroid locations you found to get back to the original space.
But looking at your gamut, I don't see any real clusters that kmeans would do a good job at finding. You can see my demo and see that kmeans doesn't do such a great job with RGB images that don't have well defined clusters in the gamut (like yours).
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!