MATLAB: RGB 2 L*A*B*

Image Processing Toolboxlab colorspacemakecformsrgb2lab

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))

Best Answer

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.