I have already converted an RGB
image into La*b*
colorspace, but I want to convert it into gray scale. I'm not sure whether I can use rgb2gray
or not.
Any idea?
The L
channel of Lab
colorspace is the grayscale part. Just use it as is. Using rgb2gray
will not work as expected, since it expects that the three channels that you give to it as an input are from RGB
colorspace.
If you have an image in the CIELa*b* colorspace representation, you could just convert it back to RGB using Lab2RGB
(can be found here) and then use the function rgb2gray
to convert your image to grayscale.
Be aware that there is a difference in the grayscale image produced by rgb2gray
and the L
channel produced by RGB2Lab
.
In Matlab, grayscale is simply achieved by
0.2989 * R + 0.5870 * G + 0.1140 * B
where the L
is achieved via a way more complex manner (see source code), hence gives a different result.
So choose wisely according to your needs or requirements!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With