필터 지우기
필터 지우기

RGB 2 L*A*B*

조회 수: 3 (최근 30일)
Adrian
Adrian 2013년 9월 2일
댓글: Image Analyst 2018년 12월 12일
Hello, I tried to convert an image from rgb to LAB colorspace. I used the code from an example I found on matworks:
cform2lab = makecform('srgb2lab');
LAB = applycform(rgbimage, cform2lab);
I read that LAB(:,:,1) should have values between 0 and 100 but I have values up to 255. I think a part of the transformation failed... Why? (rgbimage is a (240x320x3 uint8))

채택된 답변

David Sanchez
David Sanchez 2013년 9월 2일
LAB (:,:,1) can have values above 100. See if the following code (taking from matlab documentation) works on your machine:
rgb = imread('peppers.png');
cform = makecform('srgb2lab');
lab = applycform(rgb,cform);
image(lab)
See that lab(:,:,1) has values above 100 and the conversion works.
If any error is yielded, please, paste it here to see what is the problem.
  댓글 수: 1
Adrian
Adrian 2013년 9월 2일
"% the values of luminosity can span a range from 0 to 100; scale them
% to [0 1] range (appropriate for MATLAB(R) intensity images of class double)
% before applying the three contrast enhancement techniques"

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

추가 답변 (2개)

Image Analyst
Image Analyst 2013년 9월 3일
The help for applycform says "The output array B has the same class as A" so if you pass in uint8, you'll get uint8 out. If you use im2double() to cast to double in the range 0-1 then you'll get out 0-1 and you can then multiply by 100.

sundari ravi
sundari ravi 2018년 12월 12일
i want to know what is the advandage of using L*a*b* than any other segmentation algorithm. will it help me with gray scale image
  댓글 수: 1
Image Analyst
Image Analyst 2018년 12월 12일
No it will not. For a gray scale image, all the pixels would be along the L axis. There is no A and B component for a gray scale image, by definition. So there is no reason at all to deal with LAB when you're dealing with a gray acale image. You'll have to use other segmentation methods, such as simple thresholding, or whatever your image needs. Be sure to see my Image Segmentation Tutorial, which works on gray scale images, and my color segmentation tutorials, in my File Exchange.

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

카테고리

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