如何使相机旋转?(阿鲁科图书馆) [英] How to get the camera rotation? (Aruco Library)

查看:75
本文介绍了如何使相机旋转?(阿鲁科图书馆)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图了解下载Aruco库时包含的aruco_test.cpp程序的输出.

I've been trying to understand the output of the aruco_test.cpp program that is included when you download the Aruco Library.

输出具有以下格式:

22=(236.87,86.4296) (422.581,78.3856) (418.21,228.032) (261.347,228.529) Txyz=0.00813142 -0.0148134 0.140595 Rxyz=-2.14032 0.0777095 0.138929

22是标记的唯一标识符,接下来的四对数字是标记的四个角.我的问题是两个向量Tvec和Rvec.

22 is the unique identifier of the marker, the next four pairs of numbers are the four corners of the marker. My problem here is the two vectors Tvec and Rvec.

我一直在互联网上阅读tvec是从相机中心到对象(在本例中为标记)的转换向量,而rvec是对象相对于相机的旋转.

I've been reading on the Internet that tvec is the translation vector from my camera's center to my object (the marker in this case) and that rvec is the rotation of the object with respect to my camera.

我对此有一些疑问:

我如何知道相机的轴?我的意思是,有没有办法知道x,y和z的位置?

How can I know the axis of my camera? I mean, is there a way to know where the x, y and z are facing?

如何从带照相机的物体的旋转中获取照相机的旋转?

How can I get the rotation of the camera from the rotation of the object wrt the camera?

有人可以更好地向我解释向量的含义,以便我能真正理解它吗?我认为我的主要问题是我真的不知道这些数字对实际意味着什么.

Can someone explain me the meaning of the vectors better so I can really understand it? I think my main problem here is that I don't really know what those numbers mean for real.

我一直在做一些测试,以检查旋转的工作方式,但我不太了解结果:

I've been doing some testing to check how the rotation works and I don't really understand the results:

  1. 移动相机,将标记物固定在地板上:

初始位置:摄像头看着标记-标记的"z"轴指向摄像头,"y"向上,而"x"向右:Rxyz = 2.40804 -0.0823451 0.23141

Initial position: camera looking at the marker - 'z' axis of the marker looking to the camera, 'y' is going upwards and 'x' goes to the right: Rxyz=2.40804 -0.0823451 0.23141

在标记的"x"轴上移动摄像机(向上倾斜摄像机):Rxyz = -1.97658 -0.0506794 -0.020052

Moving the camera on the 'x' axis of the marker (tilt the camera up): Rxyz=-1.97658 -0.0506794 -0.020052

将相机移至标记的"y"轴(将相机向右倾斜):Rxyz = 2.74544 -0.118551 -0.973627

Moving the camera on the 'y' axis of the marker (incline the camera to the right): Rxyz=2.74544 -0.118551 -0.973627

将相机旋转90度(向右):Rxyz = 1.80194 -1.86528 0.746029

Turn the camera 90 degrees (to the right): Rxyz=1.80194 -1.86528 0.746029

  1. 移动标记物而不是照相机,使照相机在标记物附近保持固定状态:

使用与上一种情况相同的初始位置.

Using the same initial position as in the previous case.

在"x"轴上移动标记:Rxyz = 2.23619 -0.0361307 -0.0843008

Moving the marker on its 'x' axis: Rxyz=2.23619 -0.0361307 -0.0843008

在"y"轴上移动标记:Rxyz = -2.9065 -0.0291299 -1.13356

Moving the marker on its 'y' axis: Rxyz=-2.9065 -0.0291299 -1.13356

在"z"轴(向右旋转90º)上移动标记:Rxyz = 1.78398 1.74161 -0.690203

Moving the marker on its 'z' axis (90º turn to the right): Rxyz=1.78398 1.74161 -0.690203

我一直认为向量的每个数字都是各自轴上的旋转,但是我认为我是错误的,因为如果是这种情况,那么这个值就没有太大意义了.

I've been assuming that each number of the vector was the rotation on a respective axis but I think I'm assuming wrong as this values don't make so much sense if that was the case.

推荐答案

我如何知道相机的轴?我的意思是,有没有办法知道x,y和z面向哪里?

How can I know the axis of my camera? I mean, is there a way to know where the x, y and z are facing?

这是在

如何从相机的旋转中获取相机的旋转镜头上有物体吗?

How can I get the rotation of the camera from the rotation of the object wrt the camera?

rvec 是标记相对于相机框架的旋转.您可以使用内置的rvec 转换为3x3旋转矩阵rel ="nofollow noreferrer">罗德里格斯函数.如果标记与相机镜框对齐,则此旋转矩阵应读取3x3的恒等矩阵.

rvec is the rotation of the marker with respect to the camera frame. You can convert rvec to a 3x3 rotation matrix using the built-in Rodrigues function. If the marker is aligned with camera frame, this rotation matrix should read 3x3 identity matrix.

如果获得此矩阵的逆矩阵(这是一个旋转矩阵,则该逆矩阵是矩阵的转置),即摄像机相对于标记的旋转.

If you get the inverse of this matrix (this is a rotation matrix, so the inverse is the transpose of the matrix), that is the rotation of the camera with respect to the marker.

有人可以更好地向我解释向量的含义,以便我能真正理解它吗?我认为我的主要问题是我真的不知道那些数字代表真实.

Can someone explain me the meaning of the vectors better so I can really understand it? I think my main problem here is that I don't really know what those numbers mean for real.

tvec 是从相机框的原点到检测到的标记中心的距离(这是 F_c - P 上的线该图. rvec 如以上答案所述.

tvec is the distance from the origin of the camera frame to the center of the detected marker (this is F_c - P line on the figure. rvec is as described in the above answer.

这篇关于如何使相机旋转?(阿鲁科图书馆)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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