RGB and LAB values

조회 수: 7 (최근 30일)
AKG
AKG 2020년 11월 14일
The RGB values and LAB values of a particular location on an image will be different. How can I display these values ? Should I find RGB value of the location first and then convert it into LAB color space, or is there any other way?

채택된 답변

Constantino Carlos Reyes-Aldasoro
Constantino Carlos Reyes-Aldasoro 2020년 11월 16일
RGB, LAB, HSV and many others are colour spaces, that is how to create colours that resemble what natural colours are, see for instance
Images from cameras will come as RGB in most cases, that means that every pixel has 3 values for the intensities of Red, Green and Blue channels. These will be different from LAB or any other colour space.
How can I display these values ?
Well, if you want to visualise as an image, then use imagesc or imshow where the three values will be interpreted as colour. You may want to visualise them separately as
imagesc(your_image(:,:,1)) %assuming that your image is called your_image
You may want to view the values so just type a range in the command window
your_image(1:5,1:5,1:3)
do not use semicolon in the end to echo to the screen the values.
Should I find RGB value of the location first and then convert it into LAB color space, or is there any other way?
you can convert the whole image in a single command:
your_image_LAB = rgb2lab(your_image);
Hope this helps. If this solves the problem, please accept the answer, if not, let me know.
  댓글 수: 2
AKG
AKG 2020년 11월 17일
I have an image. I want to display the RGB and LAB values of various locations of that image.
Constantino Carlos Reyes-Aldasoro
Constantino Carlos Reyes-Aldasoro 2020년 11월 17일
This will display the combination of RGB as colour:
imagesc(your_image)
if you want to see individual channels do this
subplot(311); imagesc(your_image(:,:,1));
subplot(312); imagesc(your_image(:,:,2));
subplot(313); imagesc(your_image(:,:,3));
be careful with the colour map you use, the safest is gray, but others may be better for visualisation.
And the same for the LAB
subplot(311); imagesc(your_image_LAB (:,:,1));
subplot(312); imagesc(your_image_LAB (:,:,2));
subplot(313); imagesc(your_image_LAB (:,:,3));

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Hrishikesh Borate
Hrishikesh Borate 2020년 11월 16일
Hi,
I understand that you want to display LAB color space values. By default, the Image Processing Toolbox represents colors in RGB values, but to get LAB values, rgb2lab function can be used.
For more information, refer to color space conversion.

카테고리

Help CenterFile Exchange에서 Modify Image Colors에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by