applycform results interpretation?
Show older comments
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 Comment
Roger Breton
on 15 Dec 2021
Answers (0)
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!