No supportedDepthDataFormats on iPad's LiDar Camera

I want to stream the depthmap resulting from the LiDar camera on new iPad Pro 2020.

My goal is to get something like Streaming Depth Data from the TrueDepth Camera, where the depthmap is colored, but instead of using TrueDepth camera (front), I want to adapt the code for the LiDar camera. But it seems that there is no .supportedDepthDataFormats for AVCaptureDevice with builtInWideAngleCamera (back).

I didn't get the answer, if there is no way to stream Depth Data coming from LiDar. Does anyone have a clue ?

Here is my ViewController code (extracted from Apple Sample App) :

Code Block
guard let videoDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back) else { return }
// Search for highest resolution with half-point depth values
let depthFormats = videoDevice.activeFormat.supportedDepthDataFormats
let filtered = depthFormats.filter({
CMFormatDescriptionGetMediaSubType($0.formatDescription) == kCVPixelFormatType_DepthFloat16
})
let selectedFormat = filtered.max(by: {
first, second in CMVideoFormatDescriptionGetDimensions(first.formatDescription).width < CMVideoFormatDescriptionGetDimensions(second.formatDescription).width
})
do {
try videoDevice.lockForConfiguration()
videoDevice.activeDepthDataFormat = selectedFormat
videoDevice.unlockForConfiguration()
} catch {
print("Could not lock device for configuration: \(error)")
setupResult = .configurationFailed
session.commitConfiguration()
return
}


When I am dealing with my back camera I get none format compatible with Depth Data :
depthFormats = []
and so :
filtered = [] & selectedFormat = []

My app is crashing at this point due to no supported formats, and the error's tip is to use the .supportedDepthDataFormats property ..

Can you try with .builtInDualCamera ?

No supportedDepthDataFormats on iPad's LiDar Camera
 
 
Q