Okay after finding this question and trying what it said I made some progress. However, I am attempting to use arView.session.currentFrame.smoothedSceneDepth and not arView.session.currentFrame.estimatedDepthData. Here is the updated extension: extension CVPixelBuffer { func value(from point: CGPoint) -> Float? { let width = CVPixelBufferGetWidth(self) let height = CVPixelBufferGetHeight(self) let normalizedYPosition = ((point.y / UIScreen.main.bounds.height) * 1.3).clamped(0, 1.0) let colPosition = Int(normalizedYPosition * CGFloat(height)) let rowPosition = Int(( 1 - (point.x / UIScreen.main.bounds.width)) * CGFloat(width) * 0.8) return value(column: colPosition, row: rowPosition) } func value(column: Int, row: Int) -> Float? { guard CVPixelBufferGetPixelFormatType(self) == kCVPixelFormatType_DepthFloat32 else { return nil } CVPixelBufferLockBaseAddress(self, .readOnly) if let baseAddress = CVPixelBufferGetBaseAddress(self) { let width = CVPixelBufferGetWidth(self) let index = column
Topic:
Spatial Computing
SubTopic:
ARKit
Tags: