applycform results interpretation?

조회 수: 2 (최근 30일)
Roger Breton
Roger Breton 2021년 12월 15일
댓글: Roger Breton 2021년 12월 15일
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
Roger Breton
Roger Breton 2021년 12월 15일
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!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by