点云Unity示例仅在显示的上半部分渲染点 [英] Point Cloud Unity example only renders points for the upper half of display
问题描述
我们正在尝试使Point Cloud Unity示例正常工作. 我们从git尝试了两个示例: https://github.com/googlesamples/tango-examples-unity/tree/master/UnityExamples/Assets/TangoSDK/Examples/PointCloud
We are trying to get the Point Cloud Unity example to work. We tried both the example from the 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
As well as the Depth Perception Tutorial: https://developers.google.com/project-tango/apis/unity/unity-prefab-depth
但是由于某种原因,我们只能在屏幕的上半部分获得渲染的点. 当我们快速向上倾斜设备时,我们可以看到更多的点,但是一旦渲染器赶上它们,它们就会再次消失.
But we only get points rendered on the upper half of the screen for some reason. When we quickly tilt our device up we can see more points but as soon as the renderer catches up they disappear again.
我们非常确定它可以与旧版本一起使用,但是我们可能会误会. 我们使用Unity 5.3.3,而Unity SDK是Gemma(版本1.31,2016年2月).
We are pretty sure it worked with older versions but we might be mistaking. We use Unity 5.3.3 and the Unity SDK is Gemma (Version 1.31, February 2016).
有什么想法吗?
推荐答案
Unity中的TangoDeltaPoseController和TangoPoseController都假定Unity Camera Frame与Device(默认)Frame对齐,因此矩阵dTuc为 常数矩阵
the TangoDeltaPoseController and TangoPoseController in Unity all assume Unity Camera Frame was aligned with the Device (Default) Frame, so the matrix dTuc was a constant matrix
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需要进行额外的转换,而不是使用默认的常量矩阵
but for AR or point cloud like apps, the overlay image or the point cloud was captured by the color/depth camera, the m_dTuc need an extra transformation instead of using the default constant matrix
在TangoARPoseController中是
in the TangoARPoseController it was
// 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;
我希望这会对您有所帮助.
I hope this would help you.
这篇关于点云Unity示例仅在显示的上半部分渲染点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!