floatArrayToBufferedImage

fun floatArrayToBufferedImage(inputArray: FloatArray, outputShape: TensorShape, arrayColorMode: ColorMode, isNormalized: Boolean): BufferedImage

Converts inputArray of type FloatArray to BufferedImage with outputShape provided.

The output BufferedImage will have the same ColorMode as arrayColorMode of an input tensor.

If isNormalized is true, then inputArray values considered to be in [0..1) interval and will be rescaled to [0..255) interval. Values that are outside this range are clamped to avoid artifacts on the image.

If an array requires custom processing, one can use method variation that accepts ArrayTransform.

Return

BufferedImage result image.

Parameters

inputArray

float array to convert.

outputShape

shape of the output image.

arrayColorMode
isNormalized

Boolean that indicates inputArray should be rescaled to [0..255) interval.

fun floatArrayToBufferedImage(inputArray: FloatArray, width: Int, height: Int, arrayColorMode: ColorMode, isNormalized: Boolean): BufferedImage

Converts inputArray of type FloatArray to BufferedImage with width and height provided.

The output BufferedImage will have the same ColorMode as arrayColorMode of an input tensor.

If isNormalized is true, then inputArray values considered to be in [0..1) interval and will be rescaled to [0..255) interval. Values that are outside this range are clamped to avoid artifacts on the image.

If an array requires custom processing, one can use method variation that accepts ArrayTransform.

Return

BufferedImage result image.

Parameters

inputArray

float array to convert.

width

width of the output image.

height

height of the output image.

arrayColorMode
isNormalized

Boolean that indicates inputArray should be rescaled to [0..255) interval.

fun floatArrayToBufferedImage(inputArray: FloatArray, width: Int, height: Int, arrayColorMode: ColorMode, arrayTransform: ArrayTransform? = null): BufferedImage

Converts inputArray of type FloatArray to BufferedImage with width and height provided. If a custom arrayTransform is needed, lambda or ArrayTransform can be provided.

The output BufferedImage will have the same ColorMode as arrayColorMode of an input tensor.

If an arrayTransform is given, then arrayColorMode is interpreted as a color mode of an array after transform.

inputArray is explicitly copied before applying arrayTransform.

Return

BufferedImage result image.

See also

Parameters

inputArray

float array to convert.

width

shape of the output image.

height

height of the output image.

arrayColorMode
arrayTransform

ArrayTransform implementation. Thanks to Kotlin SAM convention it can be supplied as (FloatArray) -> FloatArray lambda.