世界空间到摄像机空间空间、摄像机、世界

由网友(尘烟梦雨如墨染)分享简介:我很困惑于如何将世界空间坐标相机坐标。I am confused on how to convert world space coordinates to camera coordinates.我目前的理解是,我需要计算摄像机空间向量,其中My current understanding is that I wo...

我很困惑于如何将世界空间坐标相机坐标。

I am confused on how to convert world space coordinates to camera coordinates.

我目前的理解是,我需要计算摄像机空间向量,其中

My current understanding is that I would need to calculate the camera space vector where

N =视点 - 注视

n = eyepoint - lookat

U =向上(0,1,0)×N(标准化)

u = up(0,1,0) X n(normalized)

V =的N×U

然后,一旦我有< U,V,N>我会简单地乘以每一点?

Then once I have < U, V, N > would I simply multiply each point by ?

推荐答案

让我们假设:

眼位是电子邮件 =(e_x,e_y,e_z), 查看方向是ð =(D_X,d_y,d_z) 向上矢量是 UP =(up_x,up_y,up_z) Eye position is E=(e_x, e_y, e_z), Viewing direction is D=(d_x, d_y, d_z) Up-Vector is UP=(up_x, up_y, up_z)

现在首先构造一个正交框架:

Now first construct an orthonormal frame:

在R =二维X UP U的= R X(D) 现在,规范化D,R,U和你有一个摄像头(D,R,U)的正交帧

为了改造世界坐标框架到可以应用以下矩阵凸轮坐标框架 M_R

In order to transform the global coord frame into the cam-coord frame you can apply the following matrix M_R:

   | R_x,R_y,R_z,0 |    | U_x,U_y,U_z,0 |    | -D_x,-D_y,-D_z,0 |    | 0.0,0.0,0.0,1.0 |    | R_x, R_y, R_z, 0 | | U_x, U_y, U_z, 0 | | -D_x, -D_y, -D_z, 0| | 0.0, 0.0, 0.0, 1.0|

如果你的凸轮不能定位在全球的起源也必须申请一个翻译的 M_T

If your cam is not positioned at global origin you also have to apply a translation M_T:

   | 1,0,0,-e_x |    | 0,1,0,-e_y |    | 0,0,1,-e_z |    | 0,0,0,1 |    | 1, 0, 0, -e_x | | 0, 1, 0, -e_y | | 0, 0, 1, -e_z| | 0, 0, 0, 1|

在结束全球的全面转换矩阵凸轮COORDS是:

In the end your complete transformation matrix from global to cam-coords is:

M = M_R * M_T M = M_R * M_T    | R_x,R_y,R_z,(R点-E)|    | U_x,U_y,U_z,(U点-E)|    | -D_x,-D_y,-D_z,(D点E)|    | 0.0,0.0,0.0,1.0 |    | R_x, R_y, R_z, (R dot -E) | | U_x, U_y, U_z, (U dot -E) | | -D_x, -D_y, -D_z, (D dot E)| | 0.0, 0.0, 0.0, 1.0|
阅读全文

相关推荐

最新文章