当前位置:网站首页>使用kalibr标定工具进行单目相机和双目相机的标定
使用kalibr标定工具进行单目相机和双目相机的标定
2022-06-29 16:28:00 【超爱吃小蛋糕的66】
1.下载和编译
1.1 安装依赖项,如果中间报错,可以将下面一大托依赖分多次安装,对应的ros版本也要进行修改,我自己的是melodic
sudo apt-get install python-setuptools python-rosinstall ipython libeigen3-dev libboost-all-dev doxygen libopencv-dev
sudo apt-get install 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
pip install python-igraph
1.2 编译
mkdir -p ~/kalibr_ws/src
cd ~/kalibr_ws/src
git clone --recursive https://github.com/ori-drs/kalibr
cd ~/kalibr_ws
source /opt/ros/noetic/setup.bash
catkin init
catkin config --extend /opt/ros/noetic
catkin config --merge-devel # Necessary for catkin_tools >= 0.4.
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release
catkin build -DCMAKE_BUILD_TYPE=Release -j4
问题: 因为自己的电脑上安装了anaconda3,anaconda3其自带的python可能会影响到kalibr,貌似因为kalibr需要解析rosbag包,所以使用的python2,导致出现报错Failed to load Python extension for LZ4 support. LZ4 compression will not be availabl
真是要哭了。。。
解决办法:
在kalibr_workspace/src/kalibr/aslam_offline_calibration/kalibr/python/kalibr_calibrate_cameras.py 文件中
更改 "#!/usr/bin/env python" 成"#!/usr/bin/env python2"
2. 数据准备
2.1 bag数据录制
将录制好的BAG标定文件重新录制一下,去掉不好的图片,同时将bag的频率改为4hz
分别打开两个终端,输入一下命令并运行,等待topic的输入
rosrun topic_tools throttle messages /cam_stereo_left/csi_cam/image_raw 4.0 /left
rosrun topic_tools throttle messages /cam_stereo_right/csi_cam/image_raw 4.0 /right
新打开一个终端,用来录制视频
rosbag record -O stereo_calibra.bag /left /right
新打开一个终端,用来播放原数据集
rosbag play 0620_1280x720.bag
2.2 标定板参数文件
自己写一个,checkboard_8x6_10x10cm.yaml
target_type: 'checkerboard'
targetCols: 8
targetRows: 6
rowSpacingMeters: 0.1
colSpacingMeters: 0.1
target_type:是标定板的类型,这里使用的棋盘格targetCols:标定版列方向的角点数量targetRows:标定办行方向的角点数量rowSpacingMeters:每个棋盘格的宽,单位米colSpacingMeters:每个棋盘格的高,单位米
附上其他两种标定板对应的配置文件
“二维码标定板”
target_type: 'aprilgrid' #gridtype
tagCols: 6 #number of apriltags
tagRows: 6 #number of apriltags
tagSize: 0.088 #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[-]
“圆形标定板”
target_type: 'circlegrid' #gridtype
targetCols: 6 #number of circles (cols)
targetRows: 7 #number of circles (rows)
spacingMeters: 0.02 #distance between circles [m]
asymmetricGrid: False #use asymmetric grid (opencv) [bool]
标定板pdf生成命令:
根据需要修改下--nx,--ny,--tsize,--tspace
rosrun kalibr kalibr_create_target_pdf --type apriltag --nx 6 --ny 6 --tsize 0.02 --tspace 0.3
3. 开始标定
在工作空间目录下打开终端
source YOUR_PATH/devel/setup.bash
rosrun kalibr kalibr_calibrate_cameras --bag /home/lusx/data/stereo_calibra.bag --topics /left /right --models pinhole-radtan pinhole-radtan --target src/Kalibr/config/checkboard_8x6_10x10cm.yaml
--bag:标定数据的名称
--topics:左右目相机的topic
--models:左右目相机模型
#pinhole-radtan: 最常见的针孔模型+布朗畸变模型, 适用于大多数的角度小于120的相机, 其中畸变参数包含了径向畸变k1,k2和切向畸变p1,p2; 如果相机的畸变情况不是很严重,这个模型基本都可以; 比如我的DFOV为150的相机, 也可以用这个且去畸变效果很好;
# pinhole-equi:针孔模型+等距畸变模型,也就是KB模型所需要选择的类型,该模型的使用范围也很广,大部分的鱼眼镜头也可以,注意8参数的KB模型的畸变参数为k1,k2,k3,k4,虽然也是四个数,但与前一个模型不同的是,这里只有径向畸变的参数,而没有切向畸变tangential distortion,投影时对应的公式也不同;同时这也是opencv中cv::fisheye使用的模型;
--target:标定板参数配置文件
报错:
Cameras are not connected through mutual observations, please check the dataset. Maybe adjust the approx. sync. tolerance.
原因是两个相机不同步,既可以提高采集频率到20hz,也可以同时增加同步忍耐度 --bag-from-to 5 35 --approx-sync 0.04,
完整参数如下:
rosrun kalibr kalibr_calibrate_cameras --bag /home/lusx/data/stereo_calibra.bag --bag-from-to 5 100 --topics /left /right --models pinhole-radtan pinhole-radtan --target src/Kalibr/config/checkboard_8x6_10x10cm.yaml --approx-sync 0.04
3.3 标定结果
生成3个文件,参数可以在stereo_calibra-camchain.yaml查看,细节可以在stereo_calibra-report-cam.pdf中查看
stereo_calibra-camchain.yaml内容:
4参数优化
然而标定得到的内外参感觉有拉跨,不知道是不是使用的原始数据有问题,然后也没有找到两个相机的基线bf,继续优化吧。。
边栏推荐
- Interviewer: tell me about the MySQL transaction isolation level?
- 或许再过两年,ASML将可以自由给中国供应EUV光刻机
- 同样是做测试,为什么别人年薪30W+?
- Key sprite fighting monsters - multi window and multi thread background skills
- 进阶 | webgl性能优化初尝
- Science: the interrelated causes and consequences of sleep in the brain
- 代码大全读后感
- Apache atlas breakpoint view
- 解题元宇宙,网络游戏中的多元通信方案
- 八年测开经验面试28K公司后,吐血整理出高频面试题和答案
猜你喜欢

美国芯片再遭重击,Intel或将被台积电击败而沦落至全球第三

Self taught programming can understand the code, but what if you can't write it yourself

Interviewer: tell me about the MySQL transaction isolation level?

南京大学:新时代数字化人才培养方案探讨

Paper notes: e (n) equivariant graph neural networks

Summary of common MySQL statements and commands

【无标题】

Science: the interrelated causes and consequences of sleep in the brain

隐私计算助力数据的安全流通与共享

为防止被00后整顿,一公司招聘要求员工不能起诉公司
随机推荐
Basics | draw arcs in the physics engine
Small programs have a "big" role in the industrial Internet
Us chips are hit hard again, and Intel may be defeated by TSMC and reduced to the third place in the world
Sophon CE社区版上线,免费Get轻量易用、高效智能的数据分析工具
SAAS服务都有哪些优势
Locust performance pressure test tool
Comprehensive analysis of Seata distributed transaction at and XA
Sophon Base 3.1 推出MLOps功能,为企业AI能力运营插上翅膀
为防止被00后整顿,一公司招聘要求员工不能起诉公司
Sophon base 3.1 launches mlops function to provide wings for enterprise AI capability operation
基础 | 在物理引擎中画圆弧
破解湖+仓混合架构顽疾,星环科技推出自主可控云原生湖仓一体平台
Is it safe to open a compass account and speculate in stocks? How individuals open accounts for stock trading
Redis布隆过滤器和布谷鸟过滤器
What memory consuming data is stored in MySQL CDC jobmanager?
Technology sharing | broadcast function design in integrated dispatching
我,大厂测试员,降薪50%去国企,后悔了...
能够1年涨薪2次的软件测试工程师,他到底强在哪里?
Which version of JVM is the fastest?
To solve the stubborn problem of Lake + warehouse hybrid architecture, Star Ring Technology launched an independent controllable cloud native Lake warehouse integrated platform