在透视投影直角坐标系 [英] Cartesian Coordinate System in Perspective Projection

本文介绍了在透视投影直角坐标系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还在实施我的增强现实应用程序中的透视投影。我已经问了一下视口算和其他相机的东西,这是从Aldream在<一个解释一些问题href=\"http://stackoverflow.com/questions/16619104/transform-gps-points-to-screen-points-with-perspective-projection-in-android\">this螺纹

I'm still implementing a perspective projection for my augmented reality application. I've already asked some questions about the viewport-calculation and other camera stuff, which is explained from Aldream in this thread

不过,我不明白,此刻任何有用的价值,我想这取决于我的直角坐标计算空间。

However, I don't get any useful value at the moment and I think this depends on my calculation of the cartesian coordinate space.

我有一些不同的方式来改变纬度,经度和高度,以笛卡尔坐标空间,但没有它们似乎正常工作。目前我使用ECEF(地球为中心),但我也尝试过不同的计算,如半正矢配方和三角组合(来计算距离,两点之间的轴承x和y)。

I had some different ways to transform latitude,longitude and altitude to a cartesian coordinate space, but nothing of them seems to work properly. Currently I'm using ECEF(earth centered), but I also tried different calculations like a combination of the haversine-formula and trigonometry (to calculate x and y from the distance and the bearing between two points).

所以我的问题是:

如何直角坐标空间影响我的透视投影?我在哪里有补偿我的单位?(当我用米或厘米为例)?

比方说我用ECEF,比我得到的值计,因此,例如,我的相机是在(0,0,2m高度)和我的观点是(10,10,0)。现在我可以很容易地使用维基百科上提到的,后来使用DX,DY的转换功能,DZ在我的其他线程(上述)解释说。我还是不明白:请问这个投影知道就是我的坐标系中的单位?我觉得这是我目前做的错误。我不处理我的坐标系统的单位,因此,无法从我的投影任何良好的价值。

Lets say I'm using ECEF, than I get values in meter, so for example, my camera is at (0,0,2m height) and my point is at (10,10,0). Now I can easily use the function mentioned on wikipedia and afterwards using the conversion of dx,dy,dz explained in my other thread (mentioned above). What I still don't get: How does this projection "know" what my units in the coordinate system are? I think this is the mistake I'm currently doing. I don't handle the units of my coordinate system and therefore, cannot get any good value from my projection.

当我使用的坐标系以厘米为单位,所有从我的角度投影我的价值观正在增加。我在哪里有解决这个单位的问题?我一定要改造我的相机宽度和相机的高度,从像素到米?我必须转换坐标系到像素?哪个坐标系统应该用来处理这种情况?我希望你能理解我的问题。

When I'm using a coordinate system with centimeter as unit, all of my values from my perspective projection are increasing. Where do I have to "resolve" this unit-problem? Do I have to "transform" my camera-width and camera-height from pixel to meter? Do I have to convert the coordinate system to pixel? Which coordinate-system should be used to handle this situation? I hope you can understand my problem.

编辑:我解决它自己
我已经改变了我(用半正矢和轴承,然后计算X,Y,Z)从ECEF到自己的系统坐标系,现在我得到良好的价值观! :)

I solved it myself. I've changed my coordinate system from ecef to a own system (using haversine and bearing and then calculating x,y,z) and now I get good values! :)

推荐答案

我会尝试另一种方式在这里解释它,然后。 :)

I'll try another way to explain it here then. :)

简短的回答是:您的笛卡尔位置的单位并不重要,只要你保持均匀,即只要你本机既适用于你的场景和你的相机

有关较长的答案,让我们回到你使用的公式...

For the longer answer, let's go back to the formula you used...

使用:


  • D 相对直角坐标系

  • 取值您的打印面的大小

  • 研究你的传感器/记录面(即 r_x 的大小和 r_y 传感器的尺寸和 r_z 其焦距)

  • B 您可打印面的位置

  • d the relative Cartesian coordinates
  • s the size of your printable surface
  • r the size of your "sensor" / recording surface (ie r_x and r_y the size of the sensor and r_z its focal length)
  • b the position on your printable surface

..并做伪三维分析。我们有:

.. and do the pseudo dimensional analysis. We have:

[PIXEL] = (([LENGTH] x [PIXEL]) / ([LENGTH] * [LENGTH])) * [LENGTH]

无论你为单位使用长度,它会被均匀,即只有比例保持。

Whatever you use as unit for LENGTH, it will be homogenized, ie only the proportion is kept.

例如:

[PIXEL] = (([MilliM] x [PIXEL]) / ([MilliMeter] * [MilliMeter])) * [MilliMeter]
        = (([Meter/1000] x [PIXEL]) / ([Meter/1000] * [Meter/1000])) * [Meter/1000]
        = 1000 * 1000 / 1000 /1000 * (([Meter] x [PIXEL]) / ([Meter] * [Meter])) * [Meter]
        = (([Meter] x [PIXEL]) / ([Meter] * [Meter])) * [Meter]


回到我的解释你的其他线程:


Back to my explanations on your other thread:

如果我们使用这些符号来恩preSS B_X

If we use those notations to express b_x:

b_x = (d_x * s_x) / (d_z * r_x) * r_z
    = (d_x * w) / (d_z * 2 * f * tan(α)) * f
    = (d_x * w) / (d_z * 2 * tan(α)) // with w in px

是否需要在使用(D_X,d_y,d_z)=(X,Y,Z)(D_X,d_y,d_z)=( 1000 * X,1000 * Y,1000 * Z),比例 D_X / d_z 将不会改变。

现在您的问题背后的原因,你也许应该检查是否应用正确的单元到您的相机的位置/到距离现场了。还要检查你的α和焦距的单位,取决于你使用哪一个。

Now for the reasons behind your problem, you should maybe check if you apply the correct unit to the position of your camera / to its distance to the scene too. Check also your α or the unit of the focal length, depending on which one you use.

如果认为后者的建议是最有可能的。它可以很容易忘了还权单位适用于您的相机的特点。

If think the later suggestion is the most likely. It can be easy to forget to also apply the right unit to the characteristics of your camera.

这篇关于在透视投影直角坐标系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆