フィルターのクリア

CieLaB grayscal, Red and Green Channels

3 ビュー (過去 30 日間)
Queila Martins
Queila Martins 2017 年 8 月 27 日
コメント済み: Image Analyst 2017 年 8 月 27 日
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!

採用された回答

Image Analyst
Image Analyst 2017 年 8 月 27 日
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 件のコメント
Queila Martins
Queila Martins 2017 年 8 月 27 日
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 2017 年 8 月 27 日
What do you mean by "rankings"?

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by