# Image to tensor

Takes in an image and outputs a dense tensor in a predefined format.

## Inputs

image
Any image.
layout
Layout of output tensor.
outputType
The data type of output tensor elements.
• normalizeIntensity - A Boolean flag that enables or disables intensity range normalization. If enabled, the intensity levels of the input image are scaled by equation "out = ((in / channel_max) * max - offset) / divisor" before they are copied to the output tensor. This is done separately for each color channel. See normalizationFactors.
• normalizationFactors
A 3-by-3 matrix that contains the max, offset and divisor values for each color channel. Only the first row is used with grayscale images.

## Outputs

tensor
A tensor in the defined format. If the input is an RGB image, the output tensor will have three elements in the "c" dimension. Gray images produce just one. Use color converting to convert gray levels to RGB if needed. The "w" and "h" dimensions will match the size of the input image. Use image scaling or cropping as a preprocessing tool to fix the tensor size if required by the application. In NCHW and NHWC layouts, the batch size ("n") will be one.

Supported data layouts.

Enumerator
ChwLayout

Channels, height, width.

HwcLayout

Height, width, channels.

NchwLayout

Batch, channels, height, width.

NhwcLayout

Batch, height, width, channels.

Supported tensor data types.