找出增强现实应用程序的 Kinect 在 3D 空间中的位置
我们正在使用 kinect 开发增强现实应用程序。
这有一些挑战:
我们将在飞机上放置一堆物体。幸运的是,Kinect 可以为我们提供飞机的法线矢量。我们需要知道在哪里设置 OpenGL 相机(理想情况下,这是 Kinect 所在的位置)。为此,我们需要知道 Kinect 在 3D 空间中的位置,因为这两个位置应该重合。
如果您需要更多说明,请告诉我。我意识到我的解释可能不够清楚。
We're doing an augmented reality application using the kinect.
This has some challenges:
We'll have a bunch of objects resting on the plane. Fortunately, the Kinect can give us the plane's normal vector. We need to know where to set the OpenGL camera (ideally, this will be where the Kinect is located). For that, we need to know where the Kinect is in 3D space, because the two locations should be coincident.
If you need additional clarification, please tell me. I realise that my explanation may not be as clear as it needs to be.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设 Kinect 位于原点。您还知道点(在平面上)与 Kinect 的距离 - 这就是 Kinect 为您提供的该点的距离。你也知道正常情况。因此,您所要做的就是找到平面的平面方程,将其转换为矩阵并对其求逆。
给定一个点和法向量的平面方程为
我们知道 r 为
现在请记住,平面可以表示为
其中 u、v 是平面的基向量。所以我们可以将其重写为矩阵
u 和 v 可以通过选择任意“向上”和“向右”向量来确定,我建议您使用 Y=(0,1,0) 和 X=(1,0,0) ,并对已知法线 n 执行正交化,产生 u 和 v。
通过反转该矩阵,您可以实现从平面上的零点到 kinect 的变换。
Assume the Kinect at the origin. You also know the distance of point (on the plane) from the Kinect – that's what the Kinect gives you as distance of this point. You also know the normal. So all you have to do is finding the plane equation for the plane, translate it into a matrix and invert that.
The plane equation given a point and normal vector is
We know r as
Now remember that a plane can be expressed as
where u, v are the base vectors of the plane. So we can rewrite this as matrix
u and v can be determined, by choosing arbitrary "Up", and "Right" vectors, I suggest you use Y=(0,1,0) and X=(1,0,0), and perform a ortogonalisation against your known normal n, yielding u and v.
By inverting that matrix you have the transformation from your zero point on the plane to the kinect.