필터 지우기
필터 지우기

rgb2lab color conversion

조회 수: 8 (최근 30일)
Foram Sanghavi
Foram Sanghavi 2017년 10월 31일
댓글: Image Analyst 2017년 10월 31일
Hi, I am using rgb2lab color space conversion and am receiving values in the range of e+03, are these values correct?
  댓글 수: 2
Stephen23
Stephen23 2017년 10월 31일
@Foram Sanghavi: please show us the input values that produce that output.
Foram Sanghavi
Foram Sanghavi 2017년 10월 31일
If RGB values are 253,244,245 the Lab values I am getting is 6.5651e+03, 249.1664 and 58.4119 respectively similarly for RGB 242,205,220 i a getting values 6.0022e+03,1.1819e+03 and -225.2120 respectively.

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

채택된 답변

Stephen23
Stephen23 2017년 10월 31일
편집: Stephen23 2017년 10월 31일
Either convert the input argument to uint8 or divide it by 255 and you will get the correct output. Many MATLAB color/image functions assume that a double input is in the range 0-1, which clearly your data is not.
  댓글 수: 2
Foram Sanghavi
Foram Sanghavi 2017년 10월 31일
Thank you so much this has helped me a lot. Should I do same while converting back lab2rgb? because I am getting negative values in the RGB plane especially in G plane.
Image Analyst
Image Analyst 2017년 10월 31일
I think this will explain everything. Write back if it doesn't.
rgb = uint8([253,244,245])
lab = rgb2lab(rgb)
rgb = lab2rgb(lab) % Doubles in the range 0-1
rgb = uint8(255 * rgb) % Integers in the range 0-255
You'll see
rgb =
1×3 uint8 row vector
253 244 245
lab =
96.8926628404762 3.17508673704292 0.590818112564628
rgb =
0.992156862745098 0.956862745098039 0.96078431372549
rgb =
1×3 uint8 row vector
253 244 245

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by