Image

class Image<T : DType, V>(source)

Image wrapper that combines tensor data with image-specific metadata.

This class provides a type-safe representation of image data for use in data processing pipelines. It wraps an underlying tensor and tracks layout and color space information.

Example:

val image = Image.fromTensor(tensor, ImageLayout.CHW, ColorSpace.RGB)
println("Size: ${image.width} x ${image.height}")
println("Channels: ${image.channels}")

Parameters

T

The DType of the underlying tensor

V

The value type of tensor elements

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Batch size (1 if not batched).

Link copied to clipboard

Number of color channels.

Link copied to clipboard

Color space interpretation.

Link copied to clipboard
val height: Int

Image height in pixels.

Link copied to clipboard

Whether this image has a batch dimension.

Link copied to clipboard

Check if channel count matches color space.

Link copied to clipboard

Memory layout of the image data.

Link copied to clipboard

Total number of pixels (height × width).

Link copied to clipboard

The shape of the underlying tensor.

Link copied to clipboard
val tensor: Tensor<T, V>

The underlying tensor data.

Link copied to clipboard
val width: Int

Image width in pixels.

Functions

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun withColorSpace(newColorSpace: ColorSpace): Image<T, V>

Create a copy with different color space interpretation (metadata only).

Link copied to clipboard
fun withLayout(newLayout: ImageLayout): Image<T, V>

Create a copy with different layout (metadata only, no data transformation).