toNormalizedFloatArray

fun toNormalizedFloatArray(image: BufferedImage, colorMode: ColorMode? = null): FloatArray

Converts image to FloatArray and scales the values, so they would fit into the [0, 1) range.

Return

FloatArray with pixel values in the [0, 1) range

Parameters

image

image to convert

colorMode

color mode to convert the image to. null value keeps the original color mode.

fun toNormalizedFloatArray(inputStream: InputStream, colorMode: ColorMode? = null): FloatArray

Reads the image from inputStream, converts it to FloatArray and scales the values, so they would fit into the [0, 1) range.

Return

FloatArray with pixel values in the [0, 1) range

Parameters

inputStream

source of the image to convert

colorMode

color mode to convert the image to. null value keeps the original color mode.

fun toNormalizedFloatArray(imageFile: File, colorMode: ColorMode? = null): FloatArray

Reads the image from imageFile, converts it to FloatArray and scales the values, so they would fit into the [0, 1) range.

Return

FloatArray with pixel values in the [0, 1) range

Parameters

imageFile

source of the image to convert

colorMode

color mode to convert the image to. null value keeps the original color mode.