You are here : matlabImage Processingrgb2xyz

rgb2xyz() - Image Processing

xyz = rgb2xyz(rgb) converts RGB values to CIE 1931 XYZ values.

xyz = rgb2xyz(rgb,Name,Value) specifies additional options with one or more Name,Value pair arguments.


Syntax

xyz = rgb2xyz(rgb) 
xyz = rgb2xyz(rgb,Name,Value) 


Example

%Convert RGB image to XYZ
rgb = imread('peppers.png');
xyz = rgb2xyz(rgb);

%Convert RGB white to XYZ
rgb2xyz([1 1 1])
ans =
    0.9505    1.0000    1.0890

%Convert RGB color to XYZ using D50 as reference 
whitergb2xyz([.2 .3 .4],'WhitePoint','d50')
ans =
    0.0617    0.0679    0.1025
    
%Convert Adobe RGB (1998) color value to XYZ
rgb2xyz([.2 .3 .4],'ColorSpace','adobe-rgb-1998')
ans =
    0.0550    0.0631    0.1379


Output / Return Value


Limitations


Alternatives / See Also


Reference