kalibr相机和IMU一起标定

图像的采集

ROS下需要借助外部package的使用

  1. uvc_cam package
    https://github.com/ericperko/uvc_cam.git

  2. usb_cam package
    https://github.com/bosch-ros-pkg/usb_cam.git

安装 usb_cam详细步骤

  1. 方式一安装二进制包:sudo apt install ros-kinetic-usb-cam
  2. 方式二源码安装:
mkdir -p usb_cam_ws/src
cd usb_cam_ws/
catkin_make
cd usb_cam_ws/src/
git clone https://github.com/bosch-ros-pkg/usb_cam usb_cam
cd usb_cam/
mkdir build 
cd build 
cmake ..
make 

检验一下是否安装成功

rospack list 可以查看已经安装的rospack
cd usb_cam_ws/
source devel/setup.bash
一个窗口运行:roscore
另一个窗口运行:roslaunch usb_cam usb_cam-test.launch

如果是外接的摄像头需要做如下更改

cd usb_cam/launch
sudo gedit usb_cam-test.launch
<param name="video_device" value="/dev/video1" />	

0 代表电脑内置的摄像头
1 是外接摄像头

如果还有更多摄像头 依次尝试更改编号就可以

查看图像工具

UVC视频格式是MJPEG
usb_cam视频格式是mjpeg

  1. guvcview
sudo apt install guvcview
guvcview

在这里插入图片描述默认打开的是笔记本的摄像头
在这里插入图片描述

  1. image_view
    https://wiki.ros.org/image_view

  2. rqt

相机camera标定

  1. opencv标定

  2. ROS官方提供了用於单目或者双目标定的camera_calibration包。
    单目:http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration
    双目:http://wiki.ros.org/camera_calibration/Tutorials/StereoCalibration


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. In an extended version, spatial and temporal1 calibration of a camera system w.r.t. multiple IMUs as well as IMU intrinsic calibration is supported.

kalibr

相机内参标定

在估计出内参之后,会进行优化迭代操作。
如果是多相机标定,在完成内参标定的同时,也会完成具有交叉视野相机外参的的标定。初始估计步骤也会进行多相机基线距离的估计,用作后续的迭代优化。
如果某一时刻有多个相机同时观测靶标,则先求取视野内看见角点最多的那个相机的外参,然后根据预估计出的基线距离得到靶标到第一个相机的变换矩阵。

然后计算第一个相机的重投影误差,构造优化函数。

我们进行camera-IMU标定的目的是为了得到IMU和相机座标系的相对位姿矩阵T和相对时间延时t_shift(t_imu=t_cam + t_shift)。

我们进行camera-IMU标定的目的是为了得到IMU和相机座标系的相对位姿矩阵T和相对时间延时t_shift(t_imu=t_cam + t_shift)。
需要的文件

1、.bag:包含有图片信息和IMU数据的ROS包
2、camchain.yaml: 包含相机的内参、畸变参数的文件,如果是双目的话,还包含两个相机的位置转换矩阵;
3、IMU.yaml: 包含IMU的噪声密度、随机游走;

4、target.yaml:标定目标板的参数

所以在进行camera-IMU 标定前,我们分别要对camera内参和IMU进行标定得到相应的camchain.yaml和IMU.yaml文件
输出的结果

IMU和相机座标系的相对位姿矩阵T和重投影误差(或者像素误差,Pixel Error(像素误差)指的是the standard deviation of the reprojection error (in Pixel) in both x and y directions respectivly(在x和y方向上以像素为单位的重投影误差的标准差。根据优化的准则我们知道重投影误差越小,就说相机标定的精度越高)。
准备工作

提前准备好camchain.yaml(包含相机的内参、畸变参数的文件,如果是双目的话,还包含两个相机的位置转换矩阵)、IMU.yaml(包含IMU的噪声密度、随机游走)、target.yaml(标定目标板的参数),并制作.bag文件。

参考资料

https://github.com/ethz-asl/kalibr
https://blog.csdn.net/chengde6896383/article/details/89879364
https://blog.csdn.net/heyijia0327/article/details/43538695

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章