iOS TrueDepth框架指向点云

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

我正在尝试从iOS中的单个TrueDepth帧(AVDepthData / CVPixelBuffer)获取3D点云。我遇到了官方文档,但是似乎找不到最后丢失的部分:Streaming Depth Data from the TrueDepth Camera

此代码完美地呈现了我感兴趣的点云,但是我找不到如何从中获取以米为单位的世界坐标并将其存储为pcd文件的方法。

是否有办法读出金属深度纹理的所有3D点,或者这是错误的方法?如果是这样,我将从这里开始?

感谢您的帮助!

ios 3d metal point-clouds face-id
1个回答
0
投票

在着色器功能vertexShaderPoints中,查看以下内容:

uint2 pos;
pos.y = vertexID / depthTexture.get_width();
pos.x = vertexID % depthTexture.get_width();

// depthDataType is kCVPixelFormatType_DepthFloat16
float depth = depthTexture.read(pos).x * 1000.0f;

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

float4 xyzw = { xrw, yrw, depth, 1.f };

为您的点云作者重构此计算,我想您会找到想要的东西。

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