绘制相机轨迹

3
给定一组SE(3) 4x4位姿矩阵,可以得到相机的欧几里得坐标系位置如下:

enter image description here

其中R是3x3旋转矩阵,t是位姿的平移向量,详见这个问题
当一组位姿按顺序处理时,例如每个位姿都指代某个时间步长中相机的位姿时,旋转和平移分量可以累加如下:

enter image description here

以及

enter image description here

两者都可插入第一个方程中,得到给定时间步长下相机的相对位置。
我的问题是如何使用OpenCV或类似工具绘制这些点。对于一个以圆周运动围绕物体的相机,输出图应为圆形,原点位于轨迹起点。
以下是示例: enter image description here 虽然我的问题并不明确要求像上面那样绘制坐标轴,但这将是一个额外的奖励。
简而言之:给定一组位姿,我们如何使用常见工具(如OpenCV、VTK、Matplotlib、MATLAB等)生成像上面那样的图。

你也会用Blender吗?动画通常是运动更有用的可视化。 - Francesco Callari
如果它能给我所需的输出,那么这是一个选项。然而,我从未使用过Blender。 - Jack H
1个回答

2
  1. obtain axises vectors X,Y,Z and position O for each plot point

    simply extract them form matrix. See Understanding 4x4 homogenous transform matrices. Now I do not know if your matrices are already inverse or not. So if your matrices represent camera coordinate system (not inverted) extract needed info directly. If not first invert the matrix and then extract.

    If you got homogenuous transform matrix then you can do pseudo inverse by exploiting transpose operation. For more info see full pseudo inverse matrix.

  2. Render each plot point

    so first plot the axises as lines:

      red_line(O,O+a*X);
    green_line(O,O+a*Y);
     blue_line(O,O+a*Z);
    

    where a is axis lines size. And after this plot a dot for the position

    black_circle(O,r);
    

    Where r is some radius. You can use any gfx lib/engine for the plot. I would go for GDI or OpenGL but that depends solely on what are you familiar with.

    BTW. to improve avarenes of the time line you can modulate the colors intensity (start with dark and end with bright colors so you see where the motion starts and ends ...)


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接