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
    
### Camera-IMU 标定方法 Camera-IMU联合标定旨在精确确定相机和惯性测量单元(IMU)之间的相对位置和姿态关系。这一过程对于融合这两种传感器的数据至关重要,尤其是在机器人导航、自动驾驶等领域。 #### 方法概述 一种常见的做法是通过视觉里程计(VO)IMU数据的时间同步来实现外参数的估计。具体来说: - **特征匹配**:从连续图像帧中提取并匹配特征点。 - **运动模型构建**:利用这些匹配点计算相隔时间内的相机位移变换\( R_{\text{camera}} \),以及同一时间段内由IMU积分获得的姿态变化 \( R_{\text{imu}} \)[^2]。 - **优化求解**:将上述两个变换量作为约束条件设置成最小化问题,并采用奇异值分解(SVD)或其他数值算法寻找最优解——即代表两者之间转换关系的旋转和平移向量。 #### 使用Kalibr进行快速上手 为了简化这个复杂的过程,可以借助开源软件包如[Kalibr](https://github.com/ethz-asl/kalibr),它提供了完整的工具链来进行摄像头单体及多模态系统的内外参标定工作。安装方式简单明了: ```bash mkdir -p ~/kalibr_ws/src && cd ~/kalibr_ws/src git clone https://github.com/ethz-asl/kalibr.git . cd .. catkin_make source devel/setup.bash ``` 完成环境搭建之后,按照官方文档指引准备棋盘格图案及其尺寸规格等必要材料即可开展实验[^3]。 #### VINS-Fusion的应用实例 [VINS-Fusion](http://wiki.ros.org/vins_fusion) 是另一个强大的框架,在实际应用中有很好的表现效果。该方案不仅能够处理静态场景下的标定任务,还特别擅长于动态环境中实时调整外部参数。其核心在于巧妙地结合了双目视差信息与加速度计读数间的关联特性,从而实现了更加鲁棒可靠的估计性能。 ### 相关问题 1. 如何评估不同条件下Camera-IMU标定结果的好坏? 2. Kalibr支持哪些类型的传感器组合用于联合标定? 3. 在VINS-Fusion中标定时如何选择合适的初始猜测值? 4. 是否存在其他流行的Camera-IMU联合标定库或工具? 5. 对于初学者而言,学习Camera-IMU标定的最佳起点是什么?
评论 120
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

晨光ABC

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

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

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

打赏作者

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

抵扣说明:

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

余额充值