Point Cloud Unity示例仅为显示的上半部分渲染点

时间:2016-02-24 15:03:39

标签: unity3d google-project-tango

我们正在努力让Point Cloud Unity示例正常运行。 我们尝试了git中的两个例子: https://github.com/googlesamples/tango-examples-unity/tree/master/UnityExamples/Assets/TangoSDK/Examples/PointCloud

以及深度感知教程: https://developers.google.com/project-tango/apis/unity/unity-prefab-depth

但是出于某种原因,我们只能在屏幕的上半部分显示点数。 当我们快速倾斜设备时,我们可以看到更多的点数,但一旦渲染器赶上,它们就会再次消失。

我们非常确定它适用于旧版本,但我们可能会误会。 我们使用Unity 5.3.3,Unity SDK是Gemma(版本1。31,2016年2月)。

有什么想法吗?

enter image description here

1 个答案:

答案 0 :(得分:0)

Unity中的TangoDeltaPoseController和TangoPoseController都假设Unity Camera Frame与Device(默认)Frame对齐,所以矩阵dTuc是 一个常数矩阵

m_dTuc = new Matrix4x4();
m_dTuc.SetColumn(0, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
m_dTuc.SetColumn(1, new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
m_dTuc.SetColumn(2, new Vector4(0.0f, 0.0f, -1.0f, 0.0f));
m_dTuc.SetColumn(3, new Vector4(0.0f, 0.0f, 0.0f, 1.0f));

但对于AR或类似应用的点云,叠加图像或点云是 由颜色/深度相机捕获,m_dTuc需要额外的转换而不是使用默认的常量矩阵

在TangoARPoseController中

// Get the transformation of device frame with respect to IMU frame.
        pair.baseFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_IMU;
        pair.targetFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_DEVICE;
        PoseProvider.GetPoseAtTime(poseData, timestamp, pair);
        Matrix4x4 imuTd = poseData.ToMatrix4x4();

        // Get the transformation of IMU frame with respect to color camera frame.
        pair.baseFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_IMU;
        pair.targetFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_CAMERA_COLOR;
        PoseProvider.GetPoseAtTime(poseData, timestamp, pair);
        Matrix4x4 imuTc = poseData.ToMatrix4x4();

        // Get the transform of the Unity Camera frame with respect to the Color Camera frame.
        Matrix4x4 cTuc = new Matrix4x4();
        cTuc.SetColumn(0, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
        cTuc.SetColumn(1, new Vector4(0.0f, -1.0f, 0.0f, 0.0f));
        cTuc.SetColumn(2, new Vector4(0.0f, 0.0f, 1.0f, 0.0f));
        cTuc.SetColumn(3, new Vector4(0.0f, 0.0f, 0.0f, 1.0f));

        m_dTuc = Matrix4x4.Inverse(imuTd) * imuTc * cTuc;

我希望这会对你有所帮助。

相关问题