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:
Parameter | Description |
xyz | Is the CIE xyz input vector or matrix [x y z]. |
srgb | Is the resulting srgb triplet vector or matrix [r g b]. |
'wp' | Specifies the reference whitepoint, see list in ciewhitepoint or use a vector triplet [x y z]. Default: ‘D65’ |
'method' | 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:
Chromatic adaptation: http://www.brucelindbloom.com/Eqn_ChromAdapt.html