TrueDepth 到真实点云

问题描述 投票:0回答:1

我正在尝试将 TrueDepth 深度图转换为点云。有没有办法使用 Apple 内在函数将 TrueDepth 相机深度图转换为实际大小的点云?其他问题没有帮助。这就是我提取参数的方法:

        if let calibrationData = depthData.cameraCalibrationData {
            let intrinsicMatrix = calibrationData.intrinsicMatrix
            let extrinsicMatrix = calibrationData.extrinsicMatrix
            let referenceDimensions = calibrationData.intrinsicMatrixReferenceDimensions
            let intrinsicReferenceDimensionWidth = referenceDimensions.width
        }

其中深度数据:AVDepthData

我的转换代码在这里(使用 iPhone 12 内在函数和参考尺寸除以深度尺寸):

def depth_to_point_cloud(depth, intrinsics=[[2742.1404 / (4032 / 640), 0, 2015.808 / (4032 / 640)], [0, 2742.1404 / (4032 / 640), 1513.418 / (4032 / 640)], [0, 0, 1] ]):
    height, width = depth.shape
    x, y = np.meshgrid(np.arange(width), np.arange(height))
    xrw = (x - intrinsics[0][2]) * depth / intrinsics[0][0]
    yrw = (y - intrinsics[1][2]) * depth / intrinsics[1][1]
    xyzw = np.stack([xrw, yrw, depth], axis=2)
    return xyzw.reshape(-1, 3)

结果非常拉伸,看起来不像具有真实距离的点云。我缺少什么?任何帮助、问题、建议、链接、指南、文献将不胜感激!

ios iphone 3d lidar truedepth-camera
1个回答
0
投票

可能是因为它应该是......

   float xrw = (pos.x - cameraIntrinsics[2][0]) * depth / cameraIntrinsics[0][0];
   float yrw = (pos.y - cameraIntrinsics[2][1]) * depth / cameraIntrinsics[1][1];

因此 [2] 和 [0] 交换了位置,[2] 和 [1] 也交换了位置。

© www.soinside.com 2019 - 2024. All rights reserved.