Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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 Lchannel produced by RGB2Lab.

In Matlab, grayscale is simply achieved by

0.2989 * R + 0.5870 * G + 0.1140 * B 

where the Lis achieved via a way more complex manner (see source code), hence gives a different result.

So choose wisely according to your needs or requirements!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top