Main Content

xyz2uint16

Convert XYZ color values to uint16

Description

xyz16 = xyz2uint16(xyz) converts XYZ color values to type uint16.

example

Examples

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.

xyz2uint16(c)
ans = 1x3 uint16 row vector

    3277   16384   32768

Input Arguments

collapse all

Color values to convert, specified as a m-by-3 numeric matrix of color values (one color per row), or an m-by-n-by-3 numeric array.

Data Types: double

Output Arguments

collapse all

Converted color values, returned as a numeric array of the same size as the input.

Data Types: uint16

Algorithms

The Image Processing Toolbox™ software follows the convention that double-precision XYZ arrays contain 1931 CIE XYZ values (2° observer). The XYZ arrays that are uint16 follow the convention in the ICC profile specification (ICC.1:2001-4, www.color.org) 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

0.0

0

1.0

32768

1.0 + (32767/32768)

65535

Version History

Introduced before R2006a