toFloatArray

expect fun toFloatArray(mean: Float = 0.0f, std: Float = 1.0f): FloatArray

Converts the image into a normalized float array.

Each pixel channel is converted using the following formula:

normalized = (value - mean) / std

where value is the original channel value in the range [0, 255].

The output array is arranged in platform-defined channel order (typically RGB) and is suitable for use as model input.

Return

A normalized float array containing the image pixel data.

Parameters

mean

The value subtracted from each channel. Defaults to 0f.

std

The value used to divide each channel after subtraction. Defaults to 1f.