Depth

A Depth frame, captured by a CameraDepthFrameOutput or embedded in a Photo (Photo.depth).

Like a Frame, a Depth must be disposed as soon as possible, otherwise the producing pipeline might stall. It is AutoCloseable, so it can be used with use { }.

Properties

Link copied to clipboard

The DepthPixelFormats this Depth can be converted to. May be empty if conversion is not supported.

Link copied to clipboard
abstract val bytesPerRow: Int

The number of bytes per row of the underlying pixel buffer.

Link copied to clipboard

The CameraCalibrationData of this Depth, if available. iOS only.

Link copied to clipboard

The measurement accuracy of this Depth.

Link copied to clipboard

The quality classification of this Depth.

Link copied to clipboard
abstract val height: Int

The height of this Depth frame, or 0 if it is not valid anymore.

Link copied to clipboard

Whether the depth map has been filtered (smoothed) by the platform.

Link copied to clipboard
abstract val isMirrored: Boolean

Whether this Depth frame is mirrored along the vertical axis.

Link copied to clipboard
abstract val isValid: Boolean

Whether this Depth is still valid, i.e. it has not been disposed yet.

Link copied to clipboard

The rotation of this Depth relative to the output orientation. Depth data is not rotated to CameraOrientation.UP, because physically rotating buffers is expensive: rotate it yourself, or with rotate.

Link copied to clipboard

The DepthPixelFormat of this Depth frame's data.

Link copied to clipboard
abstract val timestamp: Long

The presentation timestamp of this Depth frame, in nanoseconds.

Link copied to clipboard
abstract val width: Int

The width of this Depth frame, or 0 if it is not valid anymore.

Functions

Link copied to clipboard
open override fun close()

Same as dispose, to use a Depth with use { }.

Link copied to clipboard
abstract fun convert(pixelFormat: DepthPixelFormat): Depth

Returns a new Depth frame converted to the given pixelFormat, one of availableDepthPixelFormats. The result must be disposed too. This runs synchronously, on the calling thread.

Link copied to clipboard
abstract fun convertCameraPointToDepthPoint(cameraPoint: Point): Point

Converts a point in camera sensor coordinates to this Depth's coordinates.

Link copied to clipboard
abstract fun convertDepthPointToCameraPoint(depthPoint: Point): Point

Converts a point in this Depth's coordinates to camera sensor coordinates.

Link copied to clipboard
abstract fun dispose()

Disposes this Depth, freeing its memory. Calling it more than once is a no-op.

Link copied to clipboard
abstract fun getDepthData(): ByteArray

Gets this Depth's data, as a copy.

Link copied to clipboard

Gets a NativeBuffer to this Depth's native platform buffer. The returned buffer must be NativeBuffer.released, otherwise the pipeline might stall.

Link copied to clipboard
abstract fun rotate(orientation: CameraOrientation, isMirrored: Boolean): Depth

Returns a new Depth frame, rotated to the given orientation and optionally mirrored. The result must be disposed too. This runs synchronously, on the calling thread.

Link copied to clipboard
abstract fun toFrame(): Frame

Converts this Depth frame to a Frame containing the depth or disparity data in the current pixelFormat. The resulting Frame must be disposed too.