I'm working currently of getting depth map from an ARFaceTrackingConfiguration but I have some trouble with this, because it's like the depth map drift a bit from RGB one (see the picture).
So I declared my configuration as ARFaceTrackingConfiguration and setup my session. And I use a delegate to wait the depth map when is ready to be captured
func session(_ session: ARSession, didUpdate frame: ARFrame) {
if (isRecording) {
if (frame.capturedDepthData? != nil){
let capturedFrame = frame
captureImages(frame: capturedFrame)
}
}
}
And I captured the camera, depthmap and rgb image from the frame
func captureImages(frame: ARFrame){
let camera = frame.camera
let pixelBuffer = frame.capturedImage
guard let depthBuffer = frame.capturedDepthData else {
print("Dropped, no depthBuffer")
return
}
}
After that I saved both depth and rbg as png to diplay them.
Thanks