MCPTAM标定部分 运行结果

这里主要记录下MCPTAM的标定结果(运行该项目主要是希望能用它标定出相机的内外参文件)

MCPTAM的安装过程参考:https://blog.csdn.net/qq_25458977/article/details/90406233

1. camera intrinsic calibration 部分

源码中的launch文件夹里面有一个camera_calibrator.launch文件,里面只给出了camera_calibrator节点的使用方式,标定的话需要额外地添加uvc_node打开ui界面进行图像的捕捉等,GettingStarted.pdf中有相关的节点使用,可以直接复制过来,如果运行的时候提醒launch文件某一行无效,全部删除,新建一个文件,自己手动录入一遍即可;

捕捉图像大概为11张左右,如果希望标定结果比较准确,尽量让棋盘格能够铺满一点,并且出现在图像的各个方位,而不仅仅是只有中间的图像;

标定结果:

image_width: 640
image_height: 480
camera_name: camera
camera_matrix:
  rows: 3
  cols: 3
  data: [1.0005351573176, -0.00191943575754414, 321.517641212176, -0.0007109109945881, 1, 245.572365752173, 0, 0, 0]
distortion_model: taylor
distortion_coefficients:
  rows: 1
  cols: 4
  data: [374.391967784045, -0.000234296822387193, 5.68557569053981e-07, -5.2792558246302e-10]
rectification_matrix:
  rows: 3
  cols: 3
  data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
projection_matrix:
  rows: 3
  cols: 4
  data: [0, 0, 0, -0, 0, 0, 0, -0, 0, 0, 0, -0]

由于这里使用的是Scaramuzza的Ocamcalib模型,所以distortion coefficient主要是采用的多项式模型,

这里a0 为 374.39, 其他依次类推;camera matrix参数依次为[1,0, cx,0,1,cy,0,0,0] 主要参数就是计算出的图像中心cx,cy;标定的结果会自动保存在calibration文件下的camera*.yaml文件中,这里的*表示的是在camera_name参数传入的名字,这个名字也需要与多相机标定时的group文件下group name传入.yaml文件中的相机的名字一致;

这里标定的两个相机分别叫做camera1, camera2;

4. Camera Extrinsic Calibration

这部分在pdf中只给出了pose calibrator node的使用情况,没有给出具体的节点使用,这里如果标定两个相机的相对位姿,也是需要调用两次uvc node,将两个相机分布在不同的namespace下,然后进行调用,具体的launch文件如下:

<launch>
<node name="camera1" pkg="uvc_camera" type="uvc_camera_node" output="screen" ns="camera1">
<param name="device" type="string" value="/dev/video2"/>
<param name="camera_info_url" type="string" value="package://mcptam/calibrations/camera1.yaml" />
</node>
<node name="camera3" pkg="uvc_camera" type="uvc_camera_node" output="screen" ns="camera3">
<param name="device" type="string" value="/dev/video0"/>
<param name="camera_info_url" type="string" value="package://mcptam/calibrations/camera3.yaml" />
</node>
<node name="pose_calibrator" pkg="mcptam" type="pose_calibrator" clear_params="true" output="screen" >
<rosparam command="load" file="$(find mcptam)/groups/$(arg group_name).yaml" />
<remap from="reset" to="pose_calibrator/reset" />
<param name="image_transport" type="string" value="compressed"/>
<param name="pattern_width" type="int" value="6"/>
<param name="pattern_height" type="int" value="8"/>
<param name="square_size" type="double" value="0.036"/>
<param name="finder_max_ssd_per_pixel" type="int" value="500" />
<param name="kf_distance_mean_diff_fraction" type="double" value="0.0" />
<param name="kf_adaptive_thresh" type="bool" value="false" />
<param name="get_pose_separately" type="bool" value="false"/>
<param name="pose_out_file" type="string" value="$(find mcptam)/poses/poses.dat" />
</node>
</launch>

这里camera_info_url 参数需要协商,主要用于后面读取外参标定时读取该文件中的参数,因此路径也一定要指定正确;

运行lanch文件后会打开两个uvc 窗口,显示两个摄像头的捕捉图像,这里的处理状态主要分为四种:

CHECKERBOARD_INIT CHECKERBOARD_FIRST_STAGE CHECKERBOARD_SECOND_STAGE CHECKERBOARD_RUNNING, 四种状态在运行的时候通过窗口的外边框显示出来:

1. 最开始为深蓝色,表示初始状态,按下空格键表示开始捕捉KEYFRAME,camera1进入second stage,外边框为浅蓝色,缓慢移动标定板,给足够的时间建立camera1的地图,这个过程第一次一般要花费几分钟,一定要耐心等待;

2. camera1的地图构建完成之后外边框会变成绿色,同时自动开始标定camera2, camera2的外边框变成蓝色;

3. 按下空格键开始标定camera2,这个过程一般很快,两个相机外边框都变成绿色后,可以在此移动标定板,移动的时候尽量保证角点都被检测到,移动的范围稍微大一点,过程缓慢一点,两个相机的共同点越多,后期优化的mean square下降的越快;

pose calibrator的结果如下所示:

camera1
1 0 0 -0
0 1 0 -0
0 0 1 -0

camera2
0.99806 -0.0592349 0.0191656 -0.0544484
0.0597737 0.997794 -0.0288826 -0.00878772
-0.0174124 0.0299722 0.999399 1.44874e-05

以第一个相机的座标为世界座标,计算第二个相机的旋转和平移,camera2的3x4矩阵,最后一列为平移向量;

 

 

 

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章