CaptureSample failed to save depth data on iPad Pro

I got this error log while running the CaptureSample app on iPad Pro (with LiDar):

CaptureSample[1667:832936] [PhotoCaptureDelegate] colorSpace .linearGray not available... can't save depth data!

Answered by Rainyear in 678062022

I have found the answer. Dual Camera & True Depth Camera are not supported on iPad Pro.

Accepted Answer

I have found the answer. Dual Camera & True Depth Camera are not supported on iPad Pro.

You want to add the following to CameraViewModel.swift:

else if let backDualWideCameraDevice = AVCaptureDevice.default(.builtInDualWideCamera, for .video, position: .back) {
    logger.log(">>> Using dual wide back camera!")
    defaultVideoDevice = backDualWideCameraDevice
}

just before the builtInWideAngleCamera block.

It's not true to say that "dual camera is not supported on iPad Pro" (or else this wouldn't successfully log the message).

The docs state:

The built-in dual camera supports the following features:

  • Automatic switching from one camera to another when > zoom factor, light level, and focus position allow.
  • Generating depth data by measuring the disparities between the images captured by the ultrawide and wide-angle cameras.
  • Delivery of photos from constituent ultrawide and wide-angle devices through a single photo capture request.

Looking more closely at the error, it's actually the else condition of an if block with 2 conditions, only one of which is colorSpace linearGray being unavailable, the other is simply a failure to capture depthData. If you separate out the 2 conditions and log separate errors, you see that there is no problem with the colorSpace, it's coming from the depthData property.

There are a few things you have to do right to ensure you can access depth data, so I suspect it's absence of one of those... still looking for the answer

CaptureSample failed to save depth data on iPad Pro
 
 
Q