<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIFilter-swift.class/disparityToDepth()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Image",
      "CoreImage"
    ],
    "preciseIdentifier" : "c:objc(cs)CIFilter(cm)disparityToDepthFilter"
  },
  "title" : "disparityToDepth()"
}
-->

# disparityToDepth()

Creates depth data from an image containing disparity data.

```
class func disparityToDepth() -> any CIFilter & CIDisparityToDepth
```

## Return Value

The modified image.

## Discussion

The method generates the disparity-to-depth filter. The filter converts a depth data image to disparity data. You can combine with other filters to create more sophisticated images.

The disparity-to-depth filter uses the following property:

- `inputImage`: An image with the type [`CIImage`](/documentation/CoreImage/CIImage).

The following code creates a filter that generates a disparity depth map image:

```swift
func disparityToDepth(inputImage: CIImage) -> CIImage {
    let disparityToDepthFilter = CIFilter.disparityToDepth()
    disparityToDepthFilter.inputImage = inputImage
    return disparityToDepthFilter.outputImage!
}
```

![Two photographs of a small dog sitting on grass. The photo on the left shows the dog in the foreground with good light and a soft blur of the background. In the photo on the right, a disparity-to-depth filter is applied, resulting in a depth map created from the photo on the left. The dog in the photo and the ground are replaced with white, and the background is replaced with gray.](images/com.apple.coreimage/media-3598059@2x.png)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)