ImageToTensor

Converts a platform image to a tensor.

Uses SKaiNET's platformImageToArgb function to convert the image to a tensor with shape (1, 3, H, W) and float values in 0, 255 range.

Usage

val toTensor = ImageToTensor(executionContext)
val tensor = toTensor.apply(image) // Shape: (1, 3, H, W)

Parameters

ctx

The execution context for tensor creation

Constructors

Link copied to clipboard
constructor(ctx: ExecutionContext)

Functions

Link copied to clipboard
open override fun apply(input: PlatformBitmapImage): Tensor<FP16, Float>

Applies this transformation to the given input.

Link copied to clipboard
open override fun getOutputShape(inputShape: Shape): Shape

Computes the output shape that would result from applying this transform to data with the given input shape.

Link copied to clipboard
open override fun toString(): String