This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Convert XYZ color values to uint16


xyz16 = xyz2uint16(xyz)


xyz16 = xyz2uint16(xyz) converts an M-by-3 or M-by-N-by-3 array of XYZ color values to uint16. xyz16 has the same size as xyz.

The Image Processing Toolbox™ software follows the convention that double-precision XYZ arrays contain 1931 CIE XYZ values (2° observer). XYZ arrays that are uint16 follow the convention in the ICC profile specification (ICC.1:2001-4, for representing XYZ values as unsigned 16-bit integers. There is no standard representation of XYZ values as unsigned 8-bit integers. The ICC encoding convention is illustrated by this table.

Value (X, Y, or Z)

uint16 Value





1.0 + (32767/32768)


Class Support

xyz is a uint16 or double array that must be real and nonsparse. xyz16 is uint8.


collapse all

This example shows how to convert XYZ color values from double to uint16.

Create a double vector specifying a color in XYZ colorspace.

c = [0.1 0.5 1.0];

Convert the XYZ color value to uint16.

ans = 1x3 uint16 row vector

    3277   16384   32768

Introduced before R2006a