A capture output that records scene depth information on compatible camera devices.


A depth data output captures AVDepthData objects containing per-pixel depth or disparity information, following a streaming delivery model similar to that used by the AVCaptureVideoDataOutput class. (Alternatively, you can capture depth data alongside photos using the AVCapturePhotoOutput class: see the AVCapturePhotoSettings isDepthDataDeliveryEnabled property.)

A depth data output always provides depth data in the format expressed by the source AVCaptureDevice object's activeDepthDataFormat property. If you wish to receive depth data in another format, choose a new value for that property from those listed in the supportedDepthDataFormats array of the device's activeFormat object.


Creating a Depth Data Output


Initializes a depth data output object.

Configuring Depth Data Capture

var alwaysDiscardsLateDepthData: Bool

A Boolean value that determines whether the capture output should discard any depth data that is not processed before the next depth data is captured.

var isFilteringEnabled: Bool

A Boolean value that determines whether the depth data output should filter depth data to smooth out noise and fill invalid values.

Receiving Captured Depth Data

func setDelegate(AVCaptureDepthDataOutputDelegate, callbackQueue: DispatchQueue)

Designates a delegate object to receive depth data and a dispatch queue for delivering that data.

var delegate: AVCaptureDepthDataOutputDelegate

A delegate object that receives depth data.

var delegateCallbackQueue: DispatchQueue

A dispatch queue for delivering depth data.

protocol AVCaptureDepthDataOutputDelegate

Methods for receiving depth data produced by a depth capture output.


Inherits From

Conforms To

See Also

Depth Data Capture

class AVDepthData

A container for per-pixel distance or disparity information captured by compatible camera devices.