Borrar filtros
Borrar filtros

CieLaB grayscal, Red and Green Channels

3 visualizaciones (últimos 30 días)
Queila Martins
Queila Martins el 27 de Ag. de 2017
Comentada: Image Analyst el 27 de Ag. de 2017
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!

Respuesta aceptada

Image Analyst
Image Analyst el 27 de Ag. de 2017
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.
  2 comentarios
Queila Martins
Queila Martins el 27 de Ag. de 2017
Thank you, Image Analyst. I just wanted to be sure I was doing the right thing. In summary, I test image rankings generated with RGB in 3 channels: grayscale, red and green. I need to generate rankings with Cielab but I thought I could get grayscale, red and green as I did in RGB image. I'll perform only by getting L and A (I don't need B for now). Thank you!
Image Analyst
Image Analyst el 27 de Ag. de 2017
What do you mean by "rankings"?

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by