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


class AVCaptureDepthDataOutput : AVCaptureOutput


This out captures AVDepthData objects containing per-pixel depth or disparity information, following a streaming delivery model similar to that used by AVCaptureVideoDataOutput. Alternatively, you can capture depth data alongside photos using AVCapturePhotoOutput (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

Capturing Photos with Depth

Get a depth map with a photo to create effects like the system camera’s Portrait mode (on compatible devices).

AVCamFilter: Applying Filters to a Capture Stream

Render a capture stream with rose-colored filtering and depth effects.

Streaming Depth Data from the TrueDepth Camera

Visualize depth data in 2D and 3D from the TrueDepth camera.

Enhancing Live Video by Leveraging TrueDepth Camera Data

Apply your own background to a live capture feed streamed from the front-facing TrueDepth camera.

class AVDepthData

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

class AVPortraitEffectsMatte

An auxiliary image used to separate foreground from background with high resolution.

class AVSemanticSegmentationMatte

An object that wraps a matting image for a particular semantic segmentation.