Main Content

exrHalfAsSingle

Convert numeric values into half-precision values

Description

example

out = exrHalfAsSingle(I) converts the numeric values in I to half-precision values.

Note

The exrHalfAsSingle function does not rescale values to the range of half-precision values or to the range [0, 1].

Examples

collapse all

Read the pixel values from an image as 16-bit unsigned integers.

I = im2uint16(imread("peppers.png"));
whos I
  Name        Size                 Bytes  Class     Attributes

  I         384x512x3            1179648  uint16              

Convert the pixel values to half-precision. The half-precision values are stored as data type single.

I2 = exrHalfAsSingle(I);
whos I2
  Name        Size                 Bytes  Class     Attributes

  I2        384x512x3            2359296  single              

Input Arguments

collapse all

Input data, specified as a numeric array or a cell array of numeric arrays.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | cell

Output Arguments

collapse all

Output data, returned as a numeric array or a cell array of numeric arrays. If I is a numeric array, then out is an array the same size as I of data type single. If I is a cell array, then out is a cell array the same size as I in which each element is an array the same size as the corresponding element of I, of data type single.

Extended Capabilities

Version History

Introduced in R2022b

See Also

| | |

Topics