Hello,
Can anyone advise on how to convert a colour space of an image from RGB to lαβ ? what is the syntax for this particular conversion?
Thanks, v

댓글 수: 3

V
V 2011년 12월 4일
Hello again,
I tried the syntax - srgb2lab - and it doesn't convert the colour space. I received an error message:
>> C = makecform('srgb2lab')
??? Undefined function or variable 'makecform'.
Anyone knows how to solve this problem?
Many Thanks,
v
Dev Ba
Dev Ba 2023년 2월 6일
I tried running the script, I'm getting a rather different type of error.
>> C = makecform('srgb2lab')
C =
struct with fields:
c_func: @applycformsequence
ColorSpace_in: 'rgb'
ColorSpace_out: 'lab'
encoding: 'double'
cdata: [1×1 struct]
>> C(HCC1)
Array indices must be positive integers or logical values.
HCC1 is a tiff image loaded from my local PC. To add I'm using the online version of MATLAB.
Image Analyst
Image Analyst 2023년 2월 6일
@Dev Ba just use
labimage = rgb2lab(rgbImage);

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

 채택된 답변

Image Analyst
Image Analyst 2011년 12월 4일

0 개 추천

If you don't have the Image Processing Toolbox, you can look here for the formulas:
You can go from rgb to xyz, and then from xyz to lab. WARNING: you are not getting actual LAB values like you'd get if you measured your object with a chromameter, colorimeter, or spectrophotometer. You are merely getting "book values." Why is that? Well your object has a certain lab color but you can make the rgb values be whatever you want just by varying the exposure, white balance, or other settings. So how can all those possible rgb images give the absolute true lab values? They can't (unless you use calibrated imaging which I'm not going to get into now). All they can give you is book formulas, which make some assumptions. So you'll get different lab images for the different rgb images, not the one, true lab which is what your object actually is. I hope you understand that - did it make sense?

추가 답변 (3개)

Walter Roberson
Walter Roberson 2011년 12월 4일

0 개 추천

http://www.mathworks.com/help/toolbox/images/ref/makecform.html is part of the Image Processing Toolkit. Do you have that installed and licensed?
V
V 2011년 12월 5일

0 개 추천

Thank you guys! Yes. It works now! Thanks a lot!

질문:

V
V
2011년 12월 4일

댓글:

2023년 2월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by