MATLAB: CieLaB grayscal, Red and Green Channels

cielabcolor channelscolor spaceconversionImage Processing Toolbox

Hi,
I have a program that gets an RGB image, transforms it to grayscale and then extracts its red and green channel. I need to get the same image, convert it to Cielab color space and then transform it to grayscale and then extract the red and green channels too.
I already converted my RGB image by using commands makecform and applycform. I saw that I can extract Lab "channels" by using (:,:,1), (:,:,2) and (:,:,3), I mean, by changing the last argument in there. So, my questions are:
1) Is the L "channel" the CieLab image already in grayscale or should I perform something else to get it? 2) Is it possible to get separated red and green channels from A "channel" as I got from the image in RGB color space?
Thank you so much!

Best Answer

I think you're confused. But here is your first paragraph:
% gets an RGB image,
rgbImage = imread('peppers.png'); % Read in sample demo image.
% transforms it to grayscale
grayImage = rgb2gray(rgbImage);
% then extracts its red and green channel.
redChannel = rgbImage(:, :, 1); % Extract red channel.
greenChannel = rgbImage(:, :, 2); % Extract green channel.
% I need to get the same image, convert it to Cielab color space
labImage = rgb2lab(rgbImage);
% and then transform it to grayscale and then extract the red and green channels too.
% We already did that -- just use grayImage, redChannel, and greenChannel.
Now, for your second paragraph:
1) Is the L "channel" the CieLab image already in grayscale or should I perform something else to get it?
The L channel is a monochrome, single valued image that represents the lightness of the image. You can consider it gray scale, just like you can with redChannel or greenChannel or grayImage.
2) Is it possible to get separated red and green channels from A "channel" as I got from the image in RGB color space?
No. The A channel is also a monochrome channel and it has no red and green channels. The A channel represents the redness to greenness of the color. But the A channel is not a color image. Neither is the L channel or B channel. They're monochrome. And the labImage is not a "true color" image, as in an RGB image, so if you display it with imshow, which expects an RGB image, it will look weird. It will display the L image as red, the A image as green, and the B image as blue and the whole image will look bizarre. The lab image is not meant to be displayed. It's meant to allow for color segmentation or to measure color differences.
And to make it more confusing, the lab image you get from rgb2lab() or applycform() does not give the lab colors you'd get from your colorimeter or spectrophotometer, but that's a whole other discussion.
Related Question