applycform results interpretation?

1 visualización (últimos 30 días)
Roger Breton
Roger Breton el 15 de Dic. de 2021
Comentada: Roger Breton el 15 de Dic. de 2021
Before asking the question, allow me to reiterate my gratitude for any of the help received in adance :-)
I'm doing something in apperance very mundane :
1) Read RGB image using imread()
2) Convert RGB to Lab using cform
Yet, the results are not what I expect... Here's my code :
m = imread('3x4_RGB.tif')
cform = makecform('srgb2lab');
Lab = applycform(m,cform);
Here's my m ( 4×3×3 uint8) array :
m(:,:,1) =
128 255 255
0 0 234
245 255 0
230 0 32
m(:,:,2) =
128 0 255
255 255 181
245 0 0
229 192 0
m(:,:,3) =
128 0 0
0 255 163
245 255 255
139 64 128
And here's the Lab (4×3×3 uint8) array :
Lab(:,:,1) =
137 138 249
224 231 200
246 153 75
228 174 34
Lab(:,:,2) =
128 209 112
49 77 146
128 222 196
119 67 170
Lab(:,:,3) =
128 198 221
209 113 145
128 67 16
172 178 64
I suspect I have some massaging of numbers to do at this point?
The first RGB element reads 128,128, 128.
It's converted CIE Lab value would 137, 128, 128.
Well, I expected Lab = 54, 0, 0.
I'm missing something here.... I suspect the output values are still 'RGB-based'? For use back in some imshow() or other image display functions?
  1 comentario
Roger Breton
Roger Breton el 15 de Dic. de 2021
Basically (I'll have to research this further) but, using rgb2lab gives the expected numeric results :
Lab(:,:,1) =
53.5850 53.2408 97.1393
87.7347 91.1132 77.9855
96.5375 60.3242 32.2970
89.2650 68.0698 14.7631
Lab(:,:,2) =
0 80.0925 -21.5537
-86.1827 -48.0875 16.7037
0 98.2343 79.1875
-12.5051 -66.1018 48.1573
Lab(:,:,3) =
0 67.2032 94.4780
83.1793 -14.1312 16.5673
0 -60.8249 -107.8602
43.9621 51.3645 -61.6661
Big sigh of relief!

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by