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

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

问题描述

我想将我的视觉里程表测量结果与KITTI数据集提供的地面真实情况进行比较.对于地面中的每个帧,我都有一个投影矩阵.例如:

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点协调系统并将其投影到第一个(第0个)坐标系.因此,翻译部分(3x1第4列的向量对应于相机左坐标的姿势第i个框架中的系统到第一(第= 0)帧

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.

有人可以帮助我吗?

谢谢

推荐答案

确定要投影矩阵吗?相机投影矩阵通常是一个3x4矩阵,它将R 3 中的(同质)点投影到图像中R 2 中的(同质)点可以达到一定规模(请参见维基百科条目).听起来您有兴趣将计算的视觉里程表与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...

您有 t q ,它们的平移和旋转表示为四元数.您可以将四元数转换为旋转矩阵(通常为"sxyz"形式),反之亦然.KITTI数据指定为3x4矩阵,这是与平移矢量(即第四列为t gt )连接的旋转矩阵.

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).

r 11 r 12 r 13 t 1
r 21 r 22 r 23 t 2
r 31 r 32 r 33 t 3

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

您可以通过计算L2范数来简单地计算平移误差:|| t-t gt ||.计算旋转中的误差要困难一些.一种方法是使用Eigen的 QuaternionBase :: angularDistance()之类的函数,因为这两个测量值应在同一坐标系中.为此,您需要使用Eigen或transforms.py库将地面真理旋转矩阵转换为四元数.

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-t gt ||计算翻译错误.
  • 再次,请注意您的坐标系.

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

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