---
title: AVDepthData
framework: avfoundation
role: symbol
role_heading: Class
path: avfoundation/avdepthdata
---

# AVDepthData

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

## Declaration

```swift
class AVDepthData
```

## Mentioned in

Extracting Portrait Effects matte image data from a photo Creating auxiliary depth data manually

## Overview

Overview Depth data is a generic term for a map of per-pixel data containing depth-related information. A depth data object wraps a disparity or depth map and provides conversion methods, focus information, and camera calibration data to aid in using the map for rendering or computer vision tasks. A depth map describes at each pixel the distance to an object, in meters. A disparity map describes normalized shift values for use in comparing two images. The value for each pixel in the map is in units of 1/meters: (pixelShift / (pixelFocalLength * baselineInMeters)). The capture pipeline generates disparity or depth maps from camera images containing nonrectilinear data. Camera lenses have small imperfections that cause small distortions in their resultant images compared to an ideal pinhole camera model, so AVDepthData maps contain nonrectilinear (nondistortion-corrected) data as well. The maps’ values are warped to match the lens distortion characteristics present in the YUV image pixel buffers captured at the same time. Because a depth data map is nonrectilinear, you can use an AVDepthData map as a proxy for depth when rendering effects to its accompanying image, but not to correlate points in 3D space. To use depth data for computer vision tasks, use the data in the cameraCalibrationData property to rectify the depth data. There are two ways to capture depth data: The AVCaptureDepthDataOutput class captures and delivers depth data in a stream (similar to how the AVCaptureVideoDataOutput delivers video data). The AVCapturePhotoOutput class delivers depth data as a property of an AVCapturePhoto object containing the captured image. You can also create AVDepthData objects using information obtained from image files with the Image I/O framework. When editing images containing depth information, use the methods listed in Transforming and Processing to generate derivative AVDepthData objects reflecting the edits that have been performed.

## Topics

### Creating depth data

- [init(fromDictionaryRepresentation:)](avfoundation/avdepthdata/init(fromdictionaryrepresentation:).md)
- [dictionaryRepresentation(forAuxiliaryDataType:)](avfoundation/avdepthdata/dictionaryrepresentation(forauxiliarydatatype:).md)

### Reading pixel depth information

- [depthDataMap](avfoundation/avdepthdata/depthdatamap.md)
- [depthDataType](avfoundation/avdepthdata/depthdatatype.md)

### Evaluating depth data

- [isDepthDataFiltered](avfoundation/avdepthdata/isdepthdatafiltered.md)
- [depthDataAccuracy](avfoundation/avdepthdata/depthdataaccuracy.md)
- [AVDepthData.Accuracy](avfoundation/avdepthdata/accuracy.md)
- [depthDataQuality](avfoundation/avdepthdata/depthdataquality.md)
- [AVDepthData.Quality](avfoundation/avdepthdata/quality.md)

### Transforming and processing

- [applyingExifOrientation(_:)](avfoundation/avdepthdata/applyingexiforientation(_:).md)
- [converting(toDepthDataType:)](avfoundation/avdepthdata/converting(todepthdatatype:).md)
- [availableDepthDataTypes](avfoundation/avdepthdata/availabledepthdatatypes-3ifx1.md)
- [replacingDepthDataMap(with:)](avfoundation/avdepthdata/replacingdepthdatamap(with:).md)

### Using calibration data

- [cameraCalibrationData](avfoundation/avdepthdata/cameracalibrationdata.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Depth data capture

- [Capturing photos with depth](avfoundation/capturing-photos-with-depth.md)
- [Creating auxiliary depth data manually](avfoundation/creating-auxiliary-depth-data-manually.md)
- [Capturing depth using the LiDAR camera](avfoundation/capturing-depth-using-the-lidar-camera.md)
- [AVCamFilter: Applying filters to a capture stream](avfoundation/avcamfilter-applying-filters-to-a-capture-stream.md)
- [Streaming depth data from the TrueDepth camera](avfoundation/streaming-depth-data-from-the-truedepth-camera.md)
- [Enhancing live video by leveraging TrueDepth camera data](avfoundation/enhancing-live-video-by-leveraging-truedepth-camera-data.md)
- [AVCaptureDepthDataOutput](avfoundation/avcapturedepthdataoutput.md)
- [AVCameraCalibrationData](avfoundation/avcameracalibrationdata.md)
