FUNCTION REFERENCE

im2uint16

Convert an image to 16-bit unsigned integers.

Convert an image to 16-bit unsigned integers.

Syntax

I2 = im2uint16(I)

Syntax

I2 = im2uint16(X, 'indexed')

Double and single data are clipped to [0, 1], multiplied by 65535 and rounded half away from zero; uint8 is multiplied by 257; int16 is offset by 32768; logical true gives 65535. With 'indexed', floating indices (1-based) get 1 subtracted.

Example

im2uint16([0 0.5 1])   % uint16 [0 32768 65535]

Example

im2uint16(uint8(255))   % uint16 65535

Differences from MATLAB: none known for double, single, logical, uint8, uint16 and int16 input.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.