多相机标定&相机-IMU标定&卷帘快门相机标定工具——Kalibr

前言

在Visual-Inertial Odometry(VIO)领域,会使用IMU提高位姿估计的精度和系统鲁棒性,如:弥补图像的不足(运动模糊,弱纹理等),解决单目的尺度不确定性问题。
现在主流的方案是紧耦合,涉及到多传感器融合,就要对相机和IMU进行标定,得到两者的变换矩阵。
Kalibr就是一个有效的工具。

安装

有两种安装方法:

  • building from source:依赖于ROS indigo和catkin工作空间。二进制文件比CDE package运行得更快,并且所有工具都可用。
  • CDE package:这个包是让工具箱运行的最简单,最快捷的方法。所有依赖项都打包在此包中,不需要外部依赖项。CDE package不提供Camera focusCalibration validator工具,因为它们需要安装ROS。

注意:建议安装ROS,从源码构建工具箱,以使所有工具可用。
这里从源代码构建工具箱,按照以下步骤进行操作(已使用ROS indigo在Ubuntu 14.04上进行了测试):
0.安装ROS
1.安装依赖

sudo apt-get install python-setuptools python-rosinstall ipython libeigen3-dev libboost-all-dev doxygen libopencv-dev ros-indigo-vision-opencv ros-indigo-image-transport-plugins ros-indigo-cmake-modules python-software-properties software-properties-common libpoco-dev python-matplotlib python-scipy python-git python-pip ipython libtbb-dev libblas-dev liblapack-dev python-catkin-tools libv4l-dev
sudo pip install python-igraph --upgrade

2.创建一个catkin工作空间

mkdir -p ~/kalibr_workspace/src 
cd ~/kalibr_workspace 
source /opt/ros/indigo/setup.bash 
catkin init 
catkin config --extend /opt/ros/indigo 
catkin config --merge-devel # Necessary for catkin_tools >= 0.4. 
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release

3.将源代码仓库克隆到catkin工作空间 src 文件夹中

cd ~/kalibr_workspace/src 
git clone https://github.com/ethz-asl/Kalibr.git

4.使用 Release 配置构建代码。根据可用内存,可能需要减少构建线程(例如将 -j2 添加到catkin_make)

cd ~/kalibr_workspace 
catkin build -DCMAKE_BUILD_TYPE=Release -j4

拿一杯咖啡,这需要一段时间……(太皮了。。)
5.构建完成后,必须source catkin工作空间的设置以使用Kalibr

source ~/kalibr_workspace/devel/setup.bash

多相机标定(Multiple camera calibration)

多相机标定工具估计多相机系统的内参和外参,同时要求相邻相机具有重叠的视野。
图像数据由包含所有相机的图像流的ROS包提供。标定程序将遍历所有图像并基于信息理论度量(information theoretic measures)选择图像,以便获得对系统参数的良好估计。
投影和失真模型的任意组合可以在一次标定运行中组合。查看支持的模型页面以获取可用模型列表。

如何使用?

1.收集图像
创建包含原始图像数据的ROS包,可以通过直接从ROS传感器数据流记录,或在一系列图像文件上使用bagcreater脚本。
bagcreater脚本允许从原始图像文件和可选的IMU数据创建ROS包。必须将文件组织在文件夹中,如下所示。该示例使用具有两个摄像头和一个IMU的系统:

+-- dataset-dir
    +-- cam0
    │   +-- 1385030208726607500.png
    │   +--      ...
    │   \-- 1385030212176607500.png
    +-- cam1
    │   +-- 1385030208726607500.png
    │   +--      ...
    │   \-- 1385030212176607500.png
    \-- imu0.csv

imu0.csv 文件使用以下格式:(timestamps=[ns], omega=[rad/s], alpha=[m/s^2])

timestamp,omega_x,omega_y,omega_z,alpha_x,alpha_y,alpha_z
1385030208736607488,0.5,-0.2,-0.1,8.1,-1.9,-3.3
 ...
1386030208736607488,0.5,-0.1,-0.1,8.1,-1.9,-3.3

运行以下命令创建ROS包:

kalibr_bagcreater --folder dataset-dir --output-bag awsome.bag

在上面的示例中,数据将写入以下topics:

  • /cam0/image_raw
  • /cam1/image_raw
  • /imu0

bagextractor 将包含图像、IMU数据的ROS包导出到图像文件和IMU CSV文件。
用法示例:

kalibr_bagextractor --image-topics /cam0/image_raw /cam1/image_raw --imu-topics /imu0 --output-folder dataset-dir --bag awsome.bag

固定相机系统,并将标定目标移动到相机前面以获得标定图像。
建议在捕获标定数据时将相机帧率降低到4 Hz左右。这减少了数据集中的冗余信息,从而降低了标定的运行时间。
2.运行标定程序
必须为该工具提供以下输入:

  • –bag filename.bag
    包含数据的ROS bag
  • –topics TOPIC_0 … TOPIC_N
    list of all camera topics in the bag. matches the ordering of –models
  • –models MODEL_0 … MODEL_N
    list of camera/distortion models to be fitted. matches the ordering of –topics (see Supported models)
  • –target target.yaml
    标定板配置,见Calibration targets

运行标定:

kalibr_calibrate_cameras --bag [filename.bag] --topics [TOPIC_0 ... TOPIC_N] --models [MODEL_0 ... MODEL_N] --target [target.yaml]

由于对焦距的初始猜测不良,在处理前几个图像之后,优化可能立即发散。在这种情况下,只需尝试重新开始标定,因为初始猜测是基于随机选择的图像。
有关选项的更多信息可以使用 help 参数:

kalibr_calibrate_cameras --h

3.输出
标定将产生以下输出:

  • report-cam-%BAGNAME%.pdf: Report in PDF format. Contains all plots for documentation.
  • results-cam-%BAGNAME%.txt: Result summary as a text file.
  • camchain-%BAGNAME%.yaml: Results in YAML format. This file can be used as an input for the camera-imu calibrator. Please check the format on the YAML formats page.

4.可选的实时验证(仅限ROS)
如果您的传感器启用了ROS,您可以使用验证工具验证实时数据的标定。
有关如何执行此操作,请参阅Calibration validator页面。

相机-IMU标定(Camera IMU calibration)

1.要求
获取IMU内参。
2.收集图像
创建包含原始图像数据的ROS包,可以通过直接从ROS传感器数据流记录,或在一系列图像文件和包含IMU测量数据的CSV文件上使用bagcreater脚本。
标定目标在此标定中固定,并且camera-imu系统在目标前移动以激励所有IMU轴。
重要的是确保标定目标的良好和均匀照明,并保持相机快门时间低以避免过度的运动模糊。
通过使用20Hz的相机频率和200Hz的IMU频率已经获得了良好的结果。
提示:

  • 尝试激发所有IMU轴(旋转和平移)
  • 避免震动,特别是在拿起和放下传感器的时候
    • 保持低运动模糊:
    • 低快门时间良好的照明

警告:如果使用具有对称性的标定目标(checkerboard, circlegrid),则必须避免可能导致目标位姿估计翻转的运动。建议使用Aprilgrid以完全避免此问题。
3.运行标定
必须为该工具提供以下输入:

  • –bag filename.bag
    ROS bag containing the image and IMU data
  • –cam camchain.yaml
    intrinsic and extrinsic calibration parameters of the camera system. The output of the multiple-camera-calibration tool can be used here. (see YAML formats)
  • –imu imu.yaml
    contains the IMU statistics and the IMU’s topic (see YAML formats)
  • –target target.yaml
    the calibration target configuration (see Cailbration targets)

运行标定:

kalibr_calibrate_imu_camera --bag [filename.bag] --cam [camchain.yaml] --imu [imu.yaml] --target [target.yaml]

默认情况下,时间标定处于关闭状态,可以使用–time-calibration参数启用。有关选项的更多信息可以使用help参数:

kalibr_calibrate_imu_camera --h

4.输出
标定将生成以下输出文件:

  • report-imucam-%BAGNAME%.pdf: Report in PDF format. Contains all plots for documentation.
  • results-imucam-%BAGNAME%.txt: Result summary as a text file.
  • camchain-imucam-%BAGNAME%.yaml: Results in YAML format. This file is based on the input camchain.yaml with added transformations (and optionally time shifts) for all cameras with respect to the IMU. Please check the format on the YAML formats page.

使用样本数据集的示例

下载页面下载数据集并将其解压缩。
运行标定:

kalibr_calibrate_imu_camera --target april_6x6.yaml --cam camchain.yaml --imu imu_adis16448.yaml --bag dynamic.bag --bag-from-to 5 45

注意:由于数据集中存在震动(传感器拾取/放下),因此仅使用5到45秒之间的数据。

猜你喜欢

转载自blog.csdn.net/learning_tortosie/article/details/82495546