如何从里程计/tf 数据中获取投影矩阵? [英] How to get the projection matrix from odometry/tf data?

查看:28
本文介绍了如何从里程计/tf 数据中获取投影矩阵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的视觉里程计结果与 KITTI 数据集提供的基本事实进行比较.对于groundthruth中的每一帧,我都有一个投影矩阵.例如:

I would like to compare my results of visual Odometry with the groundtruth provided by the KITTI dataset. For each frame in the groundthruth, I have a projection matrix. For example:

1.000000e+00 9.043683e-12 2.326809e-11 1.110223e-16 9.043683e-12 1.000000e+00 2.392370e-10 2.220446e-16 2.326810e-11 2.392370e-10 9.999999e-01 -2.220446e-16

这里是自述文件提供的说明:

Here the instructions provided by the readme:

第 i 行代表第 i 个姿势左相机坐标系(即 z指向前方)通过 3x4变换矩阵.矩阵以行对齐的顺序存储(第一个条目对应于第一个行),并在第 i 个中取一个点坐标系并将其投影到第一个 (=0th) 坐标系.因此,平移部分(3x1第 4 列的向量)对应于左相机坐标的位姿第 i 帧中的系统到第一个 (=0th) 帧

Row i represents the i'th pose of the left camera coordinate system (i.e., z pointing forwards) via a 3x4 transformation matrix. The matrices are stored in row aligned order (the first entries correspond to the first row), and take a point in the i'th coordinate system and project it into the first (=0th) coordinate system. Hence, the translational part (3x1 vector of column 4) corresponds to the pose of the left camera coordinate system in the i'th frame with respect to the first (=0th) frame

但我不知道如何为我生成相同类型的数据.在我的情况下,我对每一帧都有什么:

But I don't know how to produce the same kind of data for me. What I have for each frame in my case:

  • 从 init_camera(从 (0,0,0) 中修复一个)到正在移动的左侧摄像机的 Tf 转换.所以我有平移向量和四元数旋转.
  • 里程数据:姿势和扭转
  • 相机校准参数

有了这些数据,我如何与 groundtruth 进行比较?所以我需要从上面的数据中找到投影矩阵但是不知道怎么做.

With those data, How I compare with the groundtruth ? So I need to find the projection matrix from the data above but don't know how to do it.

在大图上,我想获得一个投影矩阵或知道如何分解由基本事实提供的投影矩阵,以便将转换与我的数据进行比较.

In a big picture I would like to obtain a projection matrix or to know how to decompose the projections matrix provided by the ground truth in order to compare the transformation with my data.

有人可以帮我吗?

谢谢

推荐答案

确定要投影矩阵吗?camera 投影矩阵通常是一个 3x4 矩阵,将 R3 中的(同质)点投影到图像中 R2 中的(同质)点达到一定比例的平面(参见 wikipedia entry).听起来您有兴趣将计算出的视觉里程计与 KITTI 网站上提供的地面实况里程计进行比较;在这种情况下,您需要将来自 VO 估计的刚性变换矩阵与 KITTI 地面实况变换进行比较.

Are you sure you want the projection matrix? A camera projection matrix is typically a 3x4 matrix that projects (homogenous) points in R3 to (homogenous) points in R2 in the image plane up to some scale (see the wikipedia entry). It sounds like you are interested in comparing your computed visual odometry to the ground truth odometry provided on the KITTI website; in this case, you would be comparing the rigid transformation matrices from your VO estimation to the KITTI ground truth transformation.

如果您使用原始"数据集,则基本事实"作为 OXTS 数据记录提供 - 即 IMU 和 GPS 数据的组合.此数据位于全局框架中,需要做更多工作才能与您的数据进行比较.但是,听起来您正在使用里程计基准数据;地面实况转换已经在左相机的框架中,这应该会使任务更容易一些(这就是我将讨论的内容).

If you are using the "raw" datasets, the "ground truth" is provided as the OXTS data records - i.e. the combined IMU and GPS data. This data is in the global frame, and will take a bit more work to compare to your data. However, it sounds like you are using the odometry benchmark data; the ground truth transformations are already in the frame of the left camera, which should make the task a bit easier (and that is what I'll discuss).

由于您没有指定一种语言,我将在这里更笼统地说,但 ROS 确实提供了 C++(tf 和 Eigen)和 Python(transformations.py)工具来执行诸如从四元数转换为旋转矩阵之类的任务...

Since you haven't specified a language I'll speak more generally here, but ROS does provide tools in C++ (tf and Eigen) and Python (transformations.py) to perform tasks such as converting from quaternion to rotation matrices...

你有 tq,平移和旋转表示为一个四元数.您可以将四元数转换为旋转矩阵(通常是sxyz"形式),反之亦然.KITTI 数据被指定为 3x4 矩阵,这是与平移向量连接的旋转矩阵(即第 4 列是 tgt).

You have t and q, the translation and rotation represented as a quaternion. You can convert the quaternion to a rotation matrix (usually, 'sxyz' form) and vice versa. The KITTI data is specified as a 3x4 matrix and this is the rotation matrix concatenated with the translation vector (i.e. the 4th column is tgt).

r11 r12 r13 t1
r21 r22 r23 t2
r31 r32 r33 t3

r11 r12 r13 t1
r21 r22 r23 t2
r31 r32 r33 t3

您可以通过计算 L2 范数来简单地计算翻译误差:||t - tgt||.计算旋转中的误差有点困难;一种方法是使用 Eigen 中的 QuaternionBase::angularDistance() 之类的函数,因为两个测量值应该在同一个坐标系中.为此,您需要使用 Eigen 或 transformations.py 库将 ground truth 旋转矩阵转换为四元数.

You can simply compute the translation error by computing the L2 norm: ||t - tgt||. Computing the error in the rotation is a little bit more difficult; one way to do it is to use a function such as QuaternionBase::angularDistance() from Eigen, since both measurements should be in the same coordinate frame. To do this, you need to transform the ground truth rotation matrix into a quaternion, using either Eigen or the transformations.py library.

请记住,这是里程计框架中的误差 - 即您的第 i 个估计姿态相对于初始姿态框架中第 i 个地面真实姿态的误差.有时,逐帧比较平均误差也很有用,特别是因为里程计往往会随着时间的推移而显着漂移,即使算法在平均帧之间相对准确.

Keep in mind this is the error in the odometry frame - i.e. the error of your i-th estimated pose relative to the i-th ground truth pose in the frame of the initial pose. Sometimes, it is also useful to compare the average error frame-to-frame as well, especially since odometry tends to drift significantly over time, even if the algorithm is relatively accurate between frames on average.

总结:

  • 将旋转矩阵转换为四元数以计算角度误差(注意坐标系),
  • 并使用公式 ||t - tgt||计算翻译误差.
  • 再次注意您的坐标系.

这篇关于如何从里程计/tf 数据中获取投影矩阵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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