如何从 9 个参数中恢复 3x4 针孔相机

计算科学 最小二乘 数据集 计算机视觉
2021-12-04 20:26:53

我从这个链接下载了捆绑调整数据:

捆绑调整的原始数据

这是一篇论文的支持数据: 大范围的捆绑调整

我想将数据用于三角测量算法测试,这需要3x4针孔相机矩阵;但是针孔相机都被校准为9个参数:

例如

1.5741515942940262e-02 //first three represent the `R` rotation,
-1.2790936163850642e-02
-4.4008498081980789e-03
-3.4093839577186584e-02// 4~6 are the `t' translation vector
-1.0751387104921525e-01
1.1202240291236032e+00
3.9975152639358436e+02 // the 7th is focal length
-3.1770643852803579e-07 // the last two are radial distortion parameters.
5.8820490534594022e-13.

虽然已经有关于如何R从前三个数字中恢复的参考: Rodrigues's vector per the original authors: description here

我仍然觉得我很难理解它,尤其是如何R从前三个数字中恢复。有人有建议吗?

相机型号

We use a pinhole camera model; the parameters we estimate for each camera area rotation R, a translation t, a focal length f and two radial distortion parameters k1 and k2. The formula for projecting a 3D point X into a camera R,t,f,k1,k2 is:
P  =  R * X + t       (conversion from world to camera coordinates)
p  = -P / P.z         (perspective division)
p' =  f * r(p) * p    (conversion to pixel coordinates)
where P.z is the third (z) coordinate of P. In the last equation, r(p) is a function that computes a scaling factor to undo the radial distortion:
r(p) = 1.0 + k1 * ||p||^2 + k2 * ||p||^4.
This gives a projection in pixels, where the origin of the image is the center of the image, the positive x-axis points right, and the positive y-axis points up (in addition, in the camera coordinate system, the positive z-axis points backwards, so the camera is looking down the negative z-axis, as in OpenGL).

数据格式

Each problem is provided as a bzip2 compressed text file in the following format.

<num_cameras> <num_points> <num_observations>
<camera_index_1> <point_index_1> <x_1> <y_1>
...
<camera_index_num_observations> <point_index_num_observations> <x_num_observations> <y_num_observations>
<camera_1>
...
<camera_num_cameras>
<point_1>
...
<point_num_points>

Where, there camera and point indices start from 0. Each camera is a set of 9 parameters - R,t,f,k1 and k2. The rotation R is specified as a Rodrigues' vector.
1个回答

要将 Rodrigues 向量转换为旋转矩阵(并返回),请在此处查看 MATLAB 代码: http ://www.cs.ucla.edu/~soatto/vision/courses/268/rodrigues.m

所以这给了你旋转矩阵。

您直接使用翻译参数。

此外,您可能想要形成相机矩阵。获得完全校准的 K(涉及相机中心)将是一个好主意。如果不能,请执行以下操作:

作者声称将其作为图像中心,因此将其用作我们的中心。再次用 MATLAB 表示法: K=[f, 0, w/2; 0、f、h/2;0, 0, 1],其中 w 和 h 分别是图像的宽度和高度。然后你可以形成 P = K*[R | t] 您可以直接用于投影到图像坐标(如果您仅忽略失真)。如果您需要考虑失真,请按照作者的描述进行计算。