RGB to lαβ

5 visualizaciones (últimos 30 días)
V
V el 4 de Dic. de 2011
Comentada: Image Analyst el 6 de Feb. de 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 comentarios
Dev Ba
Dev Ba el 6 de Feb. de 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 el 6 de Feb. de 2023
@Dev Ba just use
labimage = rgb2lab(rgbImage);

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 4 de Dic. de 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?

Más respuestas (3)

bym
bym el 4 de Dic. de 2011

Walter Roberson
Walter Roberson el 4 de Dic. de 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 el 5 de Dic. de 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