Function File: lab = rgb2lab (rgb)
Function File: lab_map = rgb2lab (rgb_map)

Transform a colormap or image from sRGB to CIE L*a*b* color space.

A color in the RGB space consists of red, green, and blue intensities. The input RGB values are interpreted as nonlinear sRGB values with the white point D65. This means the input values are assumed to be in the colorimetric (sRGB) colorspace.

A color in the CIE L*a*b* (or CIE Lab) space consists of lightness L* and two color-opponent dimensions a* and b*. The whitepoint is taken as D65. The CIE L*a*b* colorspace is also a colorimetric colorspace. It is designed to incorporate the human perception of color differences.

Input values of class double, single, uint8 or uint16 are accepted. Output class is generally of type double, only input type single will result in an output type of single. The shape of the input is conserved.

note: This function returns slightly different values than the Matlab version. But it has a better "round trip accuracy" (<2e-5) for RGB -> Lab -> RGB.

See also: lab2rgb, rgb2xyz, rgb2hsv, rgb2ind, rgb2ntsc.

Package: image