3D 相机变换对 2D 图像像素的影响

发布于 2024-12-12 09:50:11 字数 390 浏览 0 评论 0原文

我有一个问题。假设我从相机捕获了图像。之后,我将相机旋转到 rX,rY,rZ(俯仰,偏航,滚动)并将其转换为( Tx , Ty , Tz )并捕获第二张图像。现在第一个图像中的图像像素点(Px,Py)将在第二个图像中的哪里?

Px,Py ( any pixel point in image - given )
rX,rY,rZ , Tx , Ty , Tz (camera rotation and translation vectors - given)
have to find new value of that pixel point after camera rotation.


有什么方程或逻辑可以解决这个问题吗?这可能更容易,但我找不到解决方案。请帮助我。
谢谢。

I have a question.Lets say i captured a image from camera.after that i rotate my camera to rX,rY,rZ( pitch , Yaw , Roll ) and translate it to ( Tx , Ty , Tz ) and capture second image .Now where will a image pixel point(Px,Py) in first image will be in second image ?

Px,Py ( any pixel point in image - given )
rX,rY,rZ , Tx , Ty , Tz (camera rotation and translation vectors - given)
have to find new value of that pixel point after camera rotation.

Any equation or logic to solve this problem ? it may be easier but i couldn't find the solution.please help me.

thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

二智少女 2024-12-19 09:50:12

您可以搜索opengl conversion math。这些链接应该为您提供 3d 旋转和平移背后的数学原理。

例如,此链接显示:

 Rotations:
  Rotation about the X axis by an angle a:
  |1       0        0    0|
  |0  cos(a)  -sin(a)    0|
  |0  sin(a)   cos(a)    0|
  |0       0        0    1|

You can search for opengl transformation math. The links should provide you the math behind rotation and translation in 3d.

For example, this link shows :

 Rotations:
  Rotation about the X axis by an angle a:
  |1       0        0    0|
  |0  cos(a)  -sin(a)    0|
  |0  sin(a)   cos(a)    0|
  |0       0        0    1|
落在眉间の轻吻 2024-12-19 09:50:11

不幸的是,您没有足够的信息来解决问题。让我们看看我是否可以在这里画一张图来向您展示原因:



      /
cam1 <    (1)   (2)   (3)
      \


                \ /
                 v
                cam2

我希望这一点很清楚。假设您从 cam1 拍摄了三张照片,其中一些对象位于 (1)(2)(3)< /代码>。在所有三种情况下,对象都恰好位于图片的中心。

现在,您将相机移动到 cam2 位置,这涉及到 Y 上逆时针旋转 90 度以及 X 和 Z 上的一些平移。

为简单起见,假设您的 Px,Py 是图片的中心。您使用 cam1 拍摄的三张照片在该像素处具有相同的对象,因此无论您使用什么方程和计算来定位 cam2 图片中的该像素,它们都会三张图片具有相同的输入,因此它们也会产生相同的输出。但显然,这是错误的,因为从 cam2 位置拍摄的三张照片中的每一张都会看到物体处于非常不同的位置,在画面中水平移动。

你看到缺少什么了吗?

如果您想正确执行此操作,则需要您的 cam1 设备也捕获 深度图,这样对于每个像素,您还可以知道它所代表的对象距相机有多远。这将区分物体远离相机的三张照片。

如果您有 Px,Py 的深度,那么您可以从 cam1 进行逆透视投影,并获取该像素相对于 cam1< 的 3D 位置/代码>。然后,您将应用逆旋转和平移将该点转换为相对于 cam2 的 3D 空间,然后执行 来自 cam2 的透视投影,以查找新的像素位置。

抱歉这个坏消息,我希望这会有所帮助!

Unfortunately you don't have enough information to solve the problem. Let's see if I can make a drawing here to show you why:



      /
cam1 <    (1)   (2)   (3)
      \


                \ /
                 v
                cam2

I hope this is clear. Let's say you take three pictures from cam1, with some object located at (1), (2) and (3). In all three cases the object is located exactly in the center of the picture.

Now you move the camera to the cam2 location, which involves a 90 degree counter clockwise rotation on Y plus some translation on X and Z.

For simplicity, let's say your Px,Py is the center of the picture. The three pictures that you took with cam1 have the same object at that pixel, so whatever equations and calculations you come up with to locate that pixel in the cam2 pictures, they will have the same input for the three pictures, so they will also produce the same output. But clearly, that will be wrong, since from the cam2 location each of the three pictures that you take will see the object in a very different position, moving horizontally across the frame.

Do you see what's missing?

If you wanted to do this properly, you would need your cam1 device to also capture a depth map, so that for each pixel you also know how far away from the camera the object represented by it was. This is what will differentiate the three pictures where the object moves farther away from the camera.

If you had the depth for Px,Py, then you can then do an inverse perspective projection from cam1 and obtain the 3D location of that pixel relative to cam1. You will then apply the inverse rotation and translation to convert the point to the 3D space relative to cam2, and then do a perspective projection from cam2 to find what will be the new pixel location.

Sorry for the bad news, I hope this helps!

温柔一刀 2024-12-19 09:50:11

您可能想阅读对极几何。除了图像坐标之外,在不知道任何其他信息的情况下,相应的像素可能位于第二张图像中的一条线上的任何位置。

You might want to read up on Epipolar Geometry. Without knowing anything else than image coordinates, your corresponding pixel could be anywhere along a line in the second image.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文