frudawski

srgb2xyz

The srgb2xyz function calculates the transformation of Matlab/Octave srgb to CIE 1931 x,y,z chromaticity coordinates.

Usage:

xyz = srgb2xyz(srgb,'wp','method')

Where:

ParameterDescription
xyzIs the CIE xyz input vector or matrix [x y z].
srgbIs the resulting srgb triplet vector or matrix [r g b].
'wp'
(optional)
Specifies the reference whitepoint, see list in ciewhitepoint or use a vector triplet [x y z].
Default: ‘D65’
'method'
(optional)
Defines the chromatic adaptation method:
‘XYZ’ (default)
‘vonKries’
‘Bradford’

Example:

Transformation of srgb to CIE 1931 x,y,z chromaticity and back:

srgb = [0.6080  0.6710  0.5385]
xyz = srgb2xyz(srgb)
srgb = xyz2srgb(xyz)

See also: xyz2srgb

Result:

srgb = 0.6080   0.6710   0.5385
xyz  = 0.3265   0.3795   0.2939
srgb = 0.6080   0.6710   0.5385

Transformation of srgb to CIE 1931 x,y,z chromaticity and back using reference whitepoint ‘D65’:

srgb = [0.5760 0.6733 0.6091]
xyz = srgb2xyz(srgb,'D50')
srgb = xyz2srgb(xyz,'D50')

See also: xyz2srgb

Result:

srgb = 0.5760   0.6733   0.6091
xyz  = 0.3312   0.3796   0.2784
srgb = 0.5760   0.6733   0.6091

Transformation of srgb to CIE 1931 x,y,z chromaticity and back using reference whitepoint ‘D50’ and ‘Bradford’ chromatic adaption method:

srgb = [0.5760 0.6733 0.6091]
xyz = srgb2xyz(srgb,'D50','Bradford')
srgb = xyz2srgb(xyz,'D50','Bradford')

See also: xyz2srgb

Result:

srgb = 0.5760   0.6733   0.6091
xyz  = 0.3324   0.3793   0.2790
srgb = 0.5760   0.6733   0.6091

References:

IEC 61966-2-1:1999: Multimedia systems and equipment - Colour measurement and management - Part 2-1: Colour management - Default RGB colour space - sRGB. International Electrotechnical Commission (IEC), Geneva, Switzerland, 1999.

Chromatic adaptation: http://www.brucelindbloom.com/Eqn_ChromAdapt.html

Leave a comment

* I accept the use of cookies as well as the terms in the privacy policy. I accept that data provided by me is processed and saved. I know that comments are saved and published after review.