Package-level declarations

Types

Link copied to clipboard

Represents how the three output channels are ordered in memory.

Link copied to clipboard

Represents the scalar encoding used for each output channel.

Link copied to clipboard

A GPUFrame represents a buffer on the GPU, often the result of a Frame that has been resized with the Resizer.

Link copied to clipboard

Represents how the individual channels per pixel are arranged in memory.

Link copied to clipboard

Represents a GPU-accelerated Frame resizer and converter.

Link copied to clipboard
data class ResizerOptions(val width: Int, val height: Int, val channelOrder: ChannelOrder, val dataType: DataType, val scaleMode: ScaleMode, val pixelLayout: PixelLayout)

Configures options for a Resizer.

Link copied to clipboard

The mode tells the GPU resize pipeline how to map the input image into the output bounds when the aspect ratio doesn't match.

Functions

Link copied to clipboard
suspend fun createResizer(options: ResizerOptions): Resizer

Create a new Resizer with the given ResizerOptions (the equivalent of VisionCamera's createResizer).

Link copied to clipboard

Gets a direct ByteBuffer over this GPUFrame's mapped Vulkan output memory, without copying (the equivalent of VisionCamera's zero-copy getPixelBuffer() ArrayBuffer), in the native byte order. It can be passed as is to ML runtimes such as LiteRT (TensorFlow Lite) or ONNX Runtime.

Link copied to clipboard
fun GPUFrame.getPixelData(): NSData

Gets an NSData over this GPUFrame's shared Metal output buffer, without copying (the equivalent of VisionCamera's zero-copy getPixelBuffer() ArrayBuffer). Its bytes can be passed as is to ML runtimes, e.g. to a Core ML MLMultiArray(dataPointer:...).

Link copied to clipboard

Returns whether the GPU-accelerated Resizer pipeline is available on this device.