FrameConverter

interface FrameConverter

Converts Frames and Depth frames to Images (port of V5's FrameConverter). Use the HybridFrameConverter instance:

frameOutput.setOnFrameCallback { frame ->
val image = frame.use { HybridFrameConverter.convertFrameToImage(it) }
// ... display or process the image
}

The resulting Image is a copy: it stays valid after the Frame or Depth is disposed.

Inheritors

Functions

Link copied to clipboard
abstract fun convertDepthToImage(depth: Depth): Image

Converts the given depth frame to an Image, with its orientation and mirroring applied. The resulting image is a grey-scale RGB image, where black pixels are far away and white pixels are close by.

Link copied to clipboard
open suspend fun convertDepthToImageAsync(depth: Depth): Image

Same as convertDepthToImage, but runs on a background dispatcher. The depth must not be disposed before this returns.

Link copied to clipboard
abstract fun convertFrameToImage(frame: Frame): Image

Converts the given frame to an Image, with its orientation and mirroring applied. This performs a CPU copy, synchronously on the calling thread.

Link copied to clipboard
open suspend fun convertFrameToImageAsync(frame: Frame): Image

Same as convertFrameToImage, but runs on a background dispatcher. The frame must not be disposed before this returns.