Kalibr 之 Camera-IMU 标定 (总结)
Last updated on May 7, 2023 pm
[TOC]
Overview
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 ZR300 和 MYNT-EYE S系列摄像头。
注意:本文用于学习kalibr标定过程,文中结果仅供参考。
1. 标定 Camera
采集 images
注意: 采集图像时,帧率控制在4帧左右
单目
1
rosbag record /camera/fisheye/image_raw -O images.bag
双目
1
rosbag record /stereo/left/image_raw /stereo/right/image_raw -O images.bag
标定 Camera
单目
1
2
3
4
5kalibr_calibrate_cameras \
--target april_6x6_24x24mm.yaml \
--bag images.bag --bag-from-to 5 20 \
--models pinhole-fov \
--topics /camera/fisheye/image_raw双目
1
2
3
4
5kalibr_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
- ROS camera_calibration
- PTAM Calibration ( ATAN / FOV camera model )
- OCamCalib toolbox
输出 cam_chain.yaml
单目
sample file output:
1
2
3
4
5
6
7cam_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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21cam0:
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
1 |
|
标定 IMU
1 |
|
ZR300.launch 文件内容
1 |
|
输出 ZR300_imu_param.yaml,sample file output:
1 |
|
输出 imu.yaml
根据标定结果修改 imu.yaml,其文件内容为
1 |
|
3. 标定 Camera-IMU
采集 images & imu 数据
单目 + IMU
1
rosbag record /camera/imu/data_raw /camera/fisheye/image_raw -O images_imu.bag
双目 + IMU
1
rosbag record /camera/imu/data_raw /stereo/left/image_raw /stereo/right/image_raw -O images_imu.bag
标定
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14cam0:
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33cam0:
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