RGB to lαβ

5 vues (au cours des 30 derniers jours)
V
V le 4 Déc 2011
Commenté : Image Analyst le 6 Fév 2023
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 commentaires
Dev Ba
Dev Ba le 6 Fév 2023
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 le 6 Fév 2023
@Dev Ba just use
labimage = rgb2lab(rgbImage);

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 4 Déc 2011
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?

Plus de réponses (3)

bym
bym le 4 Déc 2011

Walter Roberson
Walter Roberson le 4 Déc 2011
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 le 5 Déc 2011
Thank you guys! Yes. It works now! Thanks a lot!

Community Treasure Hunt

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

Start Hunting!

Translated by