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