Goal:
Take macro photos with the builtInUltraWideCamera that have depth data.
Input those images into Reality Kit Object Capture.
Tried:
Used the code bellow from the “Taking Pictures for 3D Object Capture demo code” demo:
https://developer.apple.com/documentation/realitykit/taking_pictures_for_3d_object_capture
And changed the code bellow, to use the builtInUltraWideCamera
/// This method checks for a depth-capable dual rear camera and, if found, returns an `AVCaptureDevice`.
private func getVideoDeviceForPhotogrammetry() throws -> AVCaptureDevice {
var defaultVideoDevice: AVCaptureDevice?
// Specify dual camera to get access to depth data.
if let dualCameraDevice = AVCaptureDevice.default(.builtInUltraWideCamera, for: .video,
position: .back) {
logger.log(">>> Got back dual camera!")
defaultVideoDevice = dualCameraDevice
} else if let dualWideCameraDevice = AVCaptureDevice.default(.builtInUltraWideCamera,
for: .video,
position: .back) {
logger.log(">>> Got back dual wide camera!")
defaultVideoDevice = dualWideCameraDevice
} else if let backWideCameraDevice = AVCaptureDevice.default(.builtInUltraWideCamera,
for: .video,
position: .back) {
logger.log(">>> Can't find a depth-capable camera: using wide back camera!")
defaultVideoDevice = backWideCameraDevice
}
guard let videoDevice = defaultVideoDevice else {
logger.error("Back video device is unavailable.")
throw SessionSetupError.configurationFailed
}
return videoDevice
}
Problem: the image captured doesn’t have depth data.
Question: is it possible to get a depth map from the builtInUltraWideCamera,maybe using Lidar for example?