完整版用kalibr标定 camera imu

2:相机标定
2.1:去github https://github.com/slightech/MYNT-EYE-SDK 下载小觅SDK安装 opencv的版本和SDK一定要对应,否则不成功
(因为我没有找到修改SDK源码的CMakeLists)
依据SDK中的/home/shenying/mynteye-1.8-linux-x64-gcc5-opencv-3.4.0/doc/api/mynteye-apidoc-1.8.pdf去安装
步骤为:
Prerequisites
# Install build tools
$ sudo apt-get install build-essential cmake git
# Install OpenCV dependencies
$ sudo apt-get install pkg-config libgtk2.0-dev
# Install ssl for https, v4l for video
$ sudo apt-get install libssl-dev libv4l-dev v4l-utils
Install OpenCV 3.4
$ git clone https://github.com/opencv/opencv.git
$ cd opencv/
$ git checkout tags/3.4.0
$ mkdir build
$ cd build/
$ cmake \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=/usr/local \
\
-DWITH_CUDA=OFF \
\
-DBUILD_DOCS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
..
$ make -j4
$ sudo make install
Install CUDA (Optional)
If you have Nvidia's graphic card, you could enable GPU compute capability as follows:
  • Ensure your graphic card drivers are up to date.
  • Download and install correct version of CUDA Toolkit according to here.
Install SDK
Go to the SDK directory and edit  sdk.cfg  to set your OpenCV install directory etc., then install:
$ cd
$ ./install.sh
$ source ~/.bashrc
Check Installation
After  ./install.sh , you could check the environment variables:
$ echo $MYNTEYE_SDK_ROOT
Build SDK Samples
$ cd samples/
$ mkdir build
$ cd build/
$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ make
Then you could run the sample like this:
$ ./samples/bin/camera [name]
Please see "samples/README.md" to learn more about the samples.
测试成功后,安装MYNT-EYE-OKVIS-Sample 依据github https://github.com/slightech/MYNT-EYE-OKVIS-Sample去安装
成功后 根据 /home/shenying/MYNT-EYE-OKVIS-Sample/cameraimu_calibration_guidebook.md 指导书去安装 kalibr
2.2 一般推荐源码安装kalibr https://github.com/ethz-asl/kalibr/wiki/installation
B) Building from source
To build the toolbox from source follow these steps (tested on Ubuntu 14.04 with ROS indigo):

Install ROS indigo
see ros.org for more information

Example installation on Ubuntu 16.04 and ROS kinetic:

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list'


wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install ros-kinetic-desktop python-rosinstall python-rosdep -y
rosdep init
rosdep update
Install the build and run dependencies:
依赖库一定得安,否则后期会出现各种错误;
sudo apt-get install python-setuptools python-rosinstall ipython libeigen3-dev libboost-all-dev doxygen libopencv-dev ros-kinetic-vision-opencv ros-kinetic-image-transport-plugins ros-kinetic-cmake-modules python-software-properties software-properties-common libpoco-dev python-matplotlib python-scipy python-git python-pip ipython libtbb-dev libblas-dev liblapack-dev python-catkin-tools libv4l-dev

sudo pip install python-igraph --upgrade

Create a catkin workspace

mkdir -p ~/kalibr_workspace/src
cd ~/kalibr_workspace
source /opt/ros/kinetic/setup.bash
catkin init
catkin config --extend /opt/ros/kinetic
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release

Clone the source repo into your catkin workspace src folder

cd ~/kalibr_workspace/src
git clone https://github.com/ethz-asl/Kalibr.git

Build the code using the Release configuration. depending on the available memory, you might need to reduce the build threads (e.g. add -j2 to catkin_make)

cd ~/kalibr_workspace
catkin build -DCMAKE_BUILD_TYPE=Release -j4

Grab a coffee, this will take a while...

Once the build is finished you have to source the catkin workspace setup to use Kalibr

source ~/kalibr_workspace/devel/setup.bash

More information on building with catkin and ROS can be found here.
kalibr 安装成功!
2.3 下面开始标定,用mynt-eye-okvis-sample/build 下okvis_app_getcameracalibdataset获得pic
用okvis_app_getcameraimucalibdataset获得 pic 和imu数据 然后打包成 bag包
坑1: ImportError: No module named sm
sudo apt install sm 不行
pip install sm 可以
坑2: ImportError: cannot import name PlotCollection 这个错误纠结了我近一天,感觉还是sm模块里的东西出现错误
重新卸载安装了几次依然无用,然后安装 install pip matplotlib 后出现了新的错误;
坑3:ImportError: cannot import name NavigationToolbar2Wx 然后找来专门写python的人 找下 发现 matplotlib 中没有NavigationToolbar2Wx 而是换成了NavigationToolbar2WxAgg 所以修改源码 还害怕下面用了该库中的函数,先试试
结果通过,可能是该库随着时间更新了,老版本不用了。
坑4: ImportError: No module named kalibr_common 每次出现这种情况都是没有source文件
解: source ~/kalibr_workspace/devel/setup.bash
最后:运用/home/shenying/MYNT-EYE-OKVIS-Sample/cameraimu_calibration_guidebook.md 指导书去标定
2.4如何正确解读标定结果:(费了九牛二虎之力好不容易 出来结果了,如果不会看结果就.......)
a:为什么要进行标定?
相机:为了要计算相机的内参外参数 ( 支持相机模型: pinhole, omin; 支持畸变模型:radtan, equi, fov
内参:焦距,光心 (fx,fy,cx,cy)
畸变(径向、离心、薄棱径)参数(纠正): (k1, p1, p2, s1, s2)
径向畸变:

偏离心畸变:

薄棱径畸变:非常小,一般不考虑。
b:如果不标定会出现什么情况?
相机镜头拧会影响内参,无法运用,比如orb跟丢(一种可能)
c:如何评价结果好坏?
取巧的方法:和所标期间
相机重投影误差控制在几个像素内,imu标定零偏,零漂。

你可能感兴趣的:(完整版用kalibr标定 camera imu)