Post not yet marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
contentPostList.repliesup-voted.tooltip
Replied In
Object Capture With only manual capturing
I tried to initialize session with bellow.
//MARK: Initialize Camera
private func initializeCamera() {
print("Initialize Camera")
currentCamera = AVCaptureDevice.default(.builtInLiDARDepthCamera,
for: .depthData,
position: .back)
currentSession = AVCaptureSession()
currentSession.sessionPreset = .photo
do {
let cameraInput = try AVCaptureDeviceInput(device: currentCamera)
currentSession.addInput(cameraInput)
} catch {
fatalError()
}
let videoOutput = AVCaptureVideoDataOutput()
videoOutput.setSampleBufferDelegate(self,
queue: currentDataOutputQueue)
videoOutput.videoSettings = [kCVPixelBufferPixelFormatTypeKey as String: kCVPixelFormatType_32BGRA]
currentSession.addOutput(videoOutput)
let depthOutput = AVCaptureDepthDataOutput()
depthOutput.setDelegate(self, callbackQueue: currentDataOutputQueue)
depthOutput.isFilteringEnabled = true
currentSession.addOutput(depthOutput)
currentPhotoOutput = AVCapturePhotoOutput()
currentSession.addOutput(currentPhotoOutput)
currentPhotoOutput.isDepthDataDeliveryEnabled = true
}