标定(二)----------双目相机与IMU联合标定(工具箱使用方法——Kalibr)
16個相機參數(shù):
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
kalibr website:
https://github.com/ethz-asl/kalibr/wiki/multiple-camera-calibration
https://github.com/ethz-asl/kalibr
1.安裝
Kalibr 提供兩種使用方式。第一種為CDE下直接使用,作者將所需的庫文件打包好,省去了配置dependency的步驟,可以直接從
https://github.com/ethz-asl/kalibr/wiki/downloads
下載, 注意需要科學(xué)瀏覽。
下載之后直接用
./cde-exec+命令 即可使用對應(yīng)的工具。
例如如果我們想使用kalibr內(nèi)的kalibr_calibrate_cameras功能,
使用
./ced-exec kalibr_calibrate_cameras --target april_6x6.yaml --bag static.bag --models pinhole-equi pinhole-equi omni-radtan omni-radtan --topics /cam0/image_raw /cam1/image_raw /cam2/image_raw /cam3/image_raw
單目+IMU 和 雙目+IMU 為例,講解使用 Kalibr工具 標(biāo)定 Camera-IMU,其中使用的攝像頭分別為 Realsense ZR300 和 MYNT-EYE S系列攝像頭。
2.開始標(biāo)定
Kalibr不僅提供了IMU以及camera的聯(lián)合標(biāo)定工具箱,也提供了camera標(biāo)定工具箱。
在此我們先使用camera標(biāo)定工具對相機進行標(biāo)定。
首先我們需要制作標(biāo)定板,在此推薦使用april tag,可以使用kalibr自帶工具自定義生成不同大小的標(biāo)定板,命令如下
kalibr_create_target_pdf --type apriltag --nx [NUM_COLS] --ny [NUM_ROWS] --tsize [TAG_WIDTH_M] --tspace [TAG_SPACING_PERCENT]
- roscore
- rosrun uvc_camera uvc_camera_node
- rosrun image_view image_view image:=/image_raw
- rostipic list
- rqt_image_view
- rosbag record -o test /image_raw
- rosbag play test_2019-08-14-14-22-35.bag
?
將生成的pdf打印出來,置于平穩(wěn),光照充足的地方,注意要保持平整。
Kalibr作者推薦將camera固定,然后移動標(biāo)定板,這樣可以提高標(biāo)定的穩(wěn)定性,但是鑒于我使用場景受限,我使用的是晃動camera方法。
之后就可以開始錄制bag了,使用
rosbag record /cam0/image_raw /cam1/image_raw /imu0
?
若對相機標(biāo)定結(jié)果滿意我們可以繼續(xù)進行camera以及imu的聯(lián)合標(biāo)定步驟,此步使用了如下信息:
1. 標(biāo)定板yaml
2. 相機標(biāo)定結(jié)果yaml
3. imu內(nèi)參yaml
4. 前面使用的對應(yīng)bag
有了如上材料即可進行聯(lián)合標(biāo)定,具體如下
kalibr_calibrate_imu_camera --target aprilgrid6x4.yaml --cam camchain-2017-06-14-09-13-29.yaml --imu imu.yaml --bag 2017-06-14-09-13-29.bag --bag-from-to 5 45
?最后的--bag_from_to是選取地5-45s的bag數(shù)據(jù),去除了拾取防止設(shè)備產(chǎn)生的抖動部分影響。我們建議進行多組標(biāo)定之后將標(biāo)定結(jié)果進行最佳無偏估計,不建議對R部分直接取平均值,可以將多組數(shù)據(jù)的R部分轉(zhuǎn)換成四元數(shù)。之后進行處理。
3.標(biāo)定板文件:target.yaml
Kalibr支持三種標(biāo)定板,分別是Aprilgrid、Checkerboard和Circlegrid。
4.幫助小陶的標(biāo)定記錄
?april.yaml
target_type: 'aprilgrid' #gridtype
tagCols: 6 ? ? ? ? ? ? ? #number of apriltags
tagRows: 6 ? ? ? ? ? ? ? #number of apriltags
tagSize: 0.025 ? ? ? ? ? #size of apriltag, edge to edge [m]
tagSpacing: 0.3 ? ? ? ? ?#ratio of space between tags to tagSize
? ? ? ? ? ? ? ? ? ? ? ? ?#example: tagSize=2m, spacing=0.5m --> tagSpacing=0.25[-]
imu_adis16448.yaml
rostopic: /imu/data
update_rate: 200.0 #Hz
#accelerometer_noise_density: 2.0000e-3 #continous
#accelerometer_random_walk: 1.9393e-05?
#gyroscope_noise_density: 1.6968e-04 #continous
#gyroscope_random_walk: 1.9393e-05
accelerometer_noise_density: 1.2e-2 #continous
accelerometer_random_walk: 3.0e-05?
gyroscope_noise_density: 1.0e-02 #continous
gyroscope_random_walk: 3.0e-05
?
results-imucam-2019-11-12-11-40-05.txt
Calibration results
===================
Normalized Residuals
----------------------------
Reprojection error (cam0): ? ? mean 0.233871733163, median 0.206334845347, std: 0.148605727319
Gyroscope error (imu0): ? ? ? ?mean 0.0943654955325, median 0.0867912466407, std: 0.0496732486016
Accelerometer error (imu0): ? ?mean 0.119169698923, median 0.107462875286, std: 0.0668447618807
Residuals
----------------------------
Reprojection error (cam0) [px]: ? ? mean 0.233871733163, median 0.206334845347, std: 0.148605727319
Gyroscope error (imu0) [rad/s]: ? ? mean 0.0133452963602, median 0.0122741358095, std: 0.00702485818595
Accelerometer error (imu0) [m/s^2]: mean 0.020223768533, median 0.0182370546818, std: 0.011343932259
Transformation (cam0):
-----------------------
T_ci: ?(imu0 to cam0):?
[[ 0.01032731 -0.99994666 -0.00016158 ?0.01401135]
?[ 0.03105076 ?0.0004822 ?-0.99951769 ?0.07414391]
?[ 0.99946446 ?0.01031731 ?0.03105408 -0.04191072]
?[ 0. ? ? ? ? ?0. ? ? ? ? ?0. ? ? ? ? ?1. ? ? ? ?]]
T_ic: ?(cam0 to imu0):?
[[ 0.01032731 ?0.03105076 ?0.99946446 ?0.03944135]
?[-0.99994666 ?0.0004822 ? 0.01031731 ?0.01440725]
?[-0.00016158 -0.99951769 ?0.03105408 ?0.07541191]
?[ 0. ? ? ? ? ?0. ? ? ? ? ?0. ? ? ? ? ?1. ? ? ? ?]]
timeshift cam0 to imu0: [s] (t_imu = t_cam + shift)
0.00165763516901
Gravity vector in target coords: [m/s^2]
[-0.00215999 -9.7244984 ?-1.26591825]
Calibration configuration
=========================
cam0
-----
? Camera model: omni
? Focal length: [3657.3894212462615, 3636.5284554729647]
? Principal point: [638.9568695670013, 503.393652719486]
? Omni xi: 5.80194283441
? Distortion model: radtan
? Distortion coefficients: [1.5274292230602973, -6.475270653629076, 0.0004049030197607094, 0.0019115670188138707]
? Type: aprilgrid
? Tags:?
? ? Rows: 6
? ? Cols: 6
? ? Size: 0.025 [m]
? ? Spacing 0.0075 [m]
IMU configuration
=================
IMU0:
----------------------------
? Model: calibrated
? Update rate: 200.0
? Accelerometer:
? ? Noise density: 0.012?
? ? Noise density (discrete): 0.169705627485?
? ? Random walk: 3e-05
? Gyroscope:
? ? Noise density: 0.01
? ? Noise density (discrete): 0.141421356237?
? ? Random walk: 3e-05
? T_i_b
? ? [[ 1. ?0. ?0. ?0.]
? ? ?[ 0. ?1. ?0. ?0.]
? ? ?[ 0. ?0. ?1. ?0.]
? ? ?[ 0. ?0. ?0. ?1.]]
? time offset with respect to IMU0: 0.0 [s]
Q1:I imu topics修改:如果標(biāo)定相機zed leadsensor mynt 等相機錄制IMU節(jié)點topics可能為xxx/imu/data 需要修改imu.yaml文件進行適配。
Q2:一個是利用rosbag節(jié)點運行的時候, 將發(fā)布的主題進行修改(remap )。另一個則是這roslaunch文件中進行修改.
下面利用兩種不同的方式將/image_raw‘映射到/camera/image_raw.
1. rosbag remap
?rosbag play ros.bag ?/image_raw:=/camera/image_raw
2. roslaunch remap
<remap from="/image_raw" to="/camera/image_raw"/>
?
- https://github.com/ethz-asl/kalibr/wiki/calibration-targets
- https://www.cnblogs.com/wongyi/p/11152062.html
- https://blog.csdn.net/yangdashi888/article/details/51356385
- https://github.com/ethz-asl/kalibr/wiki/camera-imu-calibration
總結(jié)
以上是生活随笔為你收集整理的标定(二)----------双目相机与IMU联合标定(工具箱使用方法——Kalibr)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 长虹电视机怎样链接笔记本电脑?
- 下一篇: “徒传辟谷法”下一句是什么