Kalibr 之 Camera-IMU 标定 (总结)

本文详细介绍使用Kalibr工具进行Camera-IMU标定的过程,包括单目、双目摄像头及IMU的标定方法,采集图像与IMU数据的步骤,以及如何评估标定结果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Overview

欢迎访问 持续更新:https://cgabc.xyz/posts/db22c2e6/

ethz-asl/kalibr is a toolbox that solves the following calibration problems:

  • Multiple camera calibration: intrinsic and extrinsic calibration of a camera-systems with non-globally shared overlapping fields of view
  • Camera-IMU calibration: spatial and temporal calibration of an IMU w.r.t a camera-system
  • Rolling Shutter Camera calibration: full intrinsic calibration (projection, distortion and shutter parameters) of rolling shutter cameras

本文以 单目+IMU双目+IMU 为例,讲解使用 Kalibr工具 标定 Camera-IMU,其中使用的摄像头分别为 Realsense ZR300MYNT-EYE S系列摄像头

注意:本文用于学习kalibr标定过程,文中结果仅供参考。

1. 标定 Camera

采集 images

注意: 采集图像时,帧率控制在4帧左右

  • 单目

    rosbag record /camera/fisheye/image_raw -O images.bag
    
  • 双目

    rosbag record /stereo/left/image_raw /stereo/right/image_raw -O images.bag
    

标定 Camera

  • 单目

    kalibr_calibrate_cameras \
        --target april_6x6_24x24mm.yaml \
        --bag images.bag --bag-from-to 5 20 \
        --models pinhole-fov \
        --topics /camera/fisheye/image_raw
    
  • 双目

    kalibr_calibrate_cameras \
        --target april_6x6_24x24mm.yaml \
        --bag images.bag --bag-from-to 5 30 \
        --models pinhole-radtan pinhole-radtan \
        --topics /stereo/left/image_raw /stereo/right/image_raw
    

标定评估

重投影误差在 0.1~0.2 以内,标定结果较好,如下所示。

Other Camera Calib Tools

输出 cam_chain.yaml

  • 单目

    sample file output:

    cam_overlaps: []
      camera_model: pinhole
      distortion_coeffs: [0.9183540411447179]
      distortion_model: fov
      intrinsics: [252.40344712951838, 253.29272771389083, 310.9288373770512, 227.37425906476517]
      resolution: [640, 480]
      rostopic: /camera/fisheye/image_raw
    
  • 双目

    sample file output:

    cam0:
      cam_overlaps: [1]
      camera_model: pinhole
      distortion_coeffs: [0.962084349711143]
      distortion_model: fov
      intrinsics: [334.23991339518517, 333.6035571693483, 368.20264278064553, 252.393048692916]
      resolution: [752, 480]
      rostopic: /stereo/left/image_raw
    cam1:
      T_cn_cnm1:
      - [0.9999904159643447, 0.0026734233431591698, -0.003467100673890538, -0.1172292375035688]
      - [-0.002666210133778015, 0.999994275307285, 0.002083428947247444, 0.0001658846059485747]
      - [0.003472650713385957, -0.002074164960638575, 0.9999918192349059, -0.0002328222935304919]
      - [0.0, 0.0, 0.0, 1.0]
      cam_overlaps: [0]
      camera_model: pinhole
      distortion_coeffs: [0.9617138563016285]
      distortion_model: fov
      intrinsics: [330.66005261900216, 330.07191301082963, 371.03802575515203, 231.03601204806853]
      resolution: [752, 480]
      rostopic: /stereo/right/image_raw
    

2. 标定 IMU

  • imu_utils: A ROS package tool to analyze the IMU performance, C++ version of Allan Variance Tool.

采集 IMU 数据

  • collect the data while the IMU is Stationary, with a two hours duration
rosbag record /camera/imu/data_raw -O imu.bag

标定 IMU

rosbag play -r 200 imu.bag
roslaunch imu_utils ZR300.launch

ZR300.launch 文件内容

<launch>
    <node pkg="imu_utils" type="imu_an" name="imu_an" output="screen">
        <param name="imu_topic" type="string" value= "/camera/imu/data_raw"/>
        <param name="imu_name" type="string" value= "ZR300"/>
        <param name="data_save_path" type="string" value= "$(find imu_utils)/data/"/>
        <param name="max_time_min" type="int" value= "80"/>
        <param name="max_cluster" type="int" value= "100"/>
    </node>
</launch>

输出 ZR300_imu_param.yaml,sample file output:

%YAML:1.0
---
type: IMU
name: ZR300
Gyr:
   unit: " rad/s"
   avg-axis:
      gyr_n: 2.7878706973951564e-03
      gyr_w: 1.6503780396374297e-05
   x-axis:
      gyr_n: 3.2763884944799469e-03
      gyr_w: 1.8012497709865783e-05
   y-axis:
      gyr_n: 2.7204386280639753e-03
      gyr_w: 1.6637042617714669e-05
   z-axis:
      gyr_n: 2.3667849696415461e-03
      gyr_w: 1.4861800861542444e-05
Acc:
   unit: " m/s^2"
   avg-axis:
      acc_n: 2.5172832889483965e-02
      acc_w: 4.4150867224248972e-04
   x-axis:
      acc_n: 2.4450765767551903e-02
      acc_w: 4.0728821351916671e-04
   y-axis:
      acc_n: 2.1474226370935746e-02
      acc_w: 2.1468705215157706e-04
   z-axis:
      acc_n: 2.9593506529964245e-02
      acc_w: 7.0255075105672530e-04

输出 imu.yaml

根据标定结果修改 imu.yaml,其文件内容为

#Accelerometers
accelerometer_noise_density: 2.52e-02   #Noise density (continuous-time)
accelerometer_random_walk:   4.41e-04   #Bias random walk

#Gyroscopes
gyroscope_noise_density:     2.78e-03   #Noise density (continuous-time)
gyroscope_random_walk:       1.65e-05   #Bias random walk

rostopic:                    /camera/imu/data_raw   #the IMU ROS topic
update_rate:                 200.0      #Hz (for discretization of the values above)

3. 标定 Camera-IMU

采集 images & imu 数据

  • 单目 + IMU

    rosbag record /camera/imu/data_raw /camera/fisheye/image_raw -O images_imu.bag
    
  • 双目 + IMU

    rosbag record /camera/imu/data_raw /stereo/left/image_raw /stereo/right/image_raw -O images_imu.bag
    

标定

kalibr_calibrate_imu_camera \
    --target april_6x6_24x24mm.yaml \
    --bag images_imu.bag \
    --bag-from-to 5 45 \
    --cam camchain.yaml \
    --imu imu.yaml \
    --imu-models scale-misalignment \
    --timeoffset-padding 0.1
  • –bag-from-to 5 45: because there are shocks in the dataset (sensor pick-up/lay-down), only the data between 5 to 45 s is used

输出 camchain-imucam.yaml

  • 单目 + IMU

    sample file output:

    cam0:
      T_cam_imu:
      - [0.9996455719455962, 0.02441693761016358, -0.010608659071806014, -0.15423539234968817]
      - [-0.024769907516072436, 0.9990969029165591, -0.03452289478279192, -0.0032297199459559245]
      - [0.00975613505470538, 0.03477343440443987, 0.9993476002315277, 0.150153755143352]
      - [0.0, 0.0, 0.0, 1.0]
      cam_overlaps: []
      camera_model: pinhole
      distortion_coeffs: [0.9183540411447179]
      distortion_model: fov
      intrinsics: [252.40344712951838, 253.29272771389083, 310.9288373770512, 227.37425906476517]
      resolution: [640, 480]
      rostopic: /camera/fisheye/image_raw
      timeshift_cam_imu: 0.7904787918609288
    
  • 双目 + IMU

    sample file output:

    cam0:
      T_cam_imu:
      - [0.0008247496568674628, 0.9999961104998093, -0.002664352314491823, 0.043041669055924436]
      - [-0.9999929524133787, 0.0008149826348758382, -0.003664822898610003, 0.003376471075594937]
      - [-0.0036626372434111396, 0.0026673560986662063, 0.9999897350972485, -0.021104195227740437]
      - [0.0, 0.0, 0.0, 1.0]
      cam_overlaps: [1]
      camera_model: pinhole
      distortion_coeffs: [0.962084349711143]
      distortion_model: fov
      intrinsics: [334.23991339518517, 333.6035571693483, 368.20264278064553, 252.393048692916]
      resolution: [752, 480]
      rostopic: /stereo/left/image_raw
      timeshift_cam_imu: 0.00019201226395901445
    cam1:
      T_cam_imu:
      - [-0.001835964017484093, 0.999979457302906, -0.00614118948676923, -0.07410578385444819]
      - [-0.9999970575613598, -0.001845664547293735, -0.001574290634432294, 0.003383609126826685]
      - [-0.001585592869970595, 0.0061382810757381065, 0.9999799034984085, -0.021194379548050524]
      - [0.0, 0.0, 0.0, 1.0]
      T_cn_cnm1:
      - [0.9999904159643451, 0.00267342334315917, -0.003467100673890538, -0.1172292375035688]
      - [-0.0026662101337780156, 0.9999942753072855, 0.0020834289472474446, 0.0001658846059485747]
      - [0.003472650713385957, -0.0020741649606385755, 0.9999918192349063, -0.0002328222935304919]
      - [0.0, 0.0, 0.0, 1.0]
      cam_overlaps: [0]
      camera_model: pinhole
      distortion_coeffs: [0.9617138563016285]
      distortion_model: fov
      intrinsics: [330.66005261900216, 330.07191301082963, 371.03802575515203, 231.03601204806853]
      resolution: [752, 480]
      rostopic: /stereo/right/image_raw
      timeshift_cam_imu: 0.0001648708557824339
    
### Kalibr标定工具简介 Kalibr 是一款用于相机和IMU联合标定的强大工具,支持多种传感器组合的校准工作。该工具能够处理单目、双目乃至多目的视觉传感器,并能实现这些设备与惯性测量单元(IMU)之间的同步标定。 ### 准备工作 为了确保良好的标定效果,在正式开始之前需确认所使用的硬件配置正确无误[^1]。对于文中提到的具体案例而言,采用的是Realsense D435i作为图像采集装置,而N100则负责提供惯性数据;整个过程基于Ubuntu 20.04操作系统环境完成设置[^2]。 ### 数据收集 在执行实际标定前,先要获取足够的样本数据集。这通常涉及到录制包含棋盘格图案运动场景下的视频片段以及对应的IMU读数。通过ROS bag文件形式保存下来以便后续分析使用。具体操作可参照如下命令: ```bash roslaunch usb_cam usb_cam-test.launch # 启动USB摄像头节点以捕获图像序列 rosbag record -O cam_imu.bag /image_raw /imu/data # 记录所需话题到指定Bag文件中去 ``` 注意:这里假设已经按照官方指南完成了相应驱动程序的部署并验证其正常运作状态[^3]。 ### 执行标定流程 当准备好高质量的数据源之后就可以调用`kalibr_calibrate_cameras`脚本来启动自动化的参数估计进程了。下面给出了一条完整的指令样例来说明如何针对针孔模型类型的摄像机实施单独或者协同式的优化计算: ```bash rosrun kalibr kalibr_calibrate_cameras \ --target 'path_to_your_target_file.yaml' \ --bag path_to_your_bagfile.bag \ --models pinhole-radtan \ --topics /image/data_raw \ --bag-from-to start_time end_time \ --show-extraction ``` 上述代码中的路径部分应当替换为本地存储的实际文件地址。此外还可以附加更多选项来自定义行为模式比如显示中间特征提取结果等辅助调试信息[^4]。 ### IMU独立标定 除了上述提及的内容外,有时也需要单独对IMU进行预处理阶段内的初步调整。此时可以借助专门为此设计的应用软件如`imu_utils`来进行更细致入微的操作,包括但不限于零偏补偿等方面的工作。 ### 联合标定注意事项 在整个过程中有几个要点值得注意: - **多次重复实验**:由于外界干扰因素较多,建议至少做三次以上的测试取平均值得出最终结论; - **保持稳定光源条件不变**:避免因光照强度变化引起不必要的误差累积; - **合理规划拍摄角度范围**:尽可能覆盖全方位视角从而获得更加全面可靠的统计数据支撑。
评论 120
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

晨光ABC

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值