Filter löschen
Filter löschen

RGB to Lab color space

3 Ansichten (letzte 30 Tage)
Ivana
Ivana am 6 Dez. 2016
Kommentiert: Ivana am 7 Dez. 2016
I want to converte RGB values to Lab, I read that conversion goes between XYZ color space. Ofcourse, I find directly alghorithm in Matlab
labTransformation = makecform('srgb2lab');
labI = applycform(image,labTransformation);
l = labI(:,:,1);
a = labI(:,:,2);
b = labI(:,:,3);
but it shows me values between 0-255 and I need standard values for Lab, L=0-100, a,b=-127+128. Because later I want calculate C and H with a, b values.
Thanks.

Akzeptierte Antwort

Adam
Adam am 6 Dez. 2016
Just using
lab = rgb2lab(rgb);
seems to give results in the expected output range. I'm not sure what all the extra work of creating a colour transform gives you, even if it did give the answer you want.
  1 Kommentar
Ivana
Ivana am 7 Dez. 2016
Thanks, I also found this conversion when I get Lab in uint 8 (0-255) to convert to Lab standard range values: L=L/2,55; a=a-127; b=b-128. I chek this and it realy works, now I will update my algorithm.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by