Function File: xyz = rgb2xyz (rgb)
Function File: xyz_map = rgb2xyz (rgb_map)

Transform a colormap or image from sRGB to CIE XYZ 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 XYZ color space consists of three values X, Y and Z. Those values are designed to be colorimetric, meaning that their values do not depend on the display device hardware.

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 -> XYZ -> RGB.

See also: xyz2rgb, rgb2lab, rgb2hsv, rgb2ind, rgb2ntsc.

Package: image