当前位置:网站首页>使用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,继续优化吧。。
边栏推荐
- A tour of gRPC:02 - 从proto生成代码
- Real test = "half product + Half development"?
- 关于onReachButton 不触发可能原因
- Key sprite fighting monsters - window binding protection skills and click skills
- Small programs have a "big" role in the industrial Internet
- Flutter技术与实战(2)
- How to configure logback? 30 minutes for you to thoroughly learn the code to stay up late and knock
- SAAS服务都有哪些优势
- 自己实现一个ThreadLocal
- Redis布隆过滤器和布谷鸟过滤器
猜你喜欢

UWB精准定位方案,厘米级高精度技术应用,智能配对感应技术

如何利用OpenMesh实现不同格式的3D文件间的转换

A tour of grpc:02 - generate code from proto

Interviewer: tell me about the MySQL transaction isolation level?

数学知识:求组合数 II—求组合数

Small programs have a "big" role in the industrial Internet

Comment configurer logback? 30 minutes pour apprendre à coder et à frapper tard.

Real test = "half product + Half development"?

Review of mathematical knowledge: curve integral of type I

iNFTnews | Meta在元宇宙中的后续计划会是什么?
随机推荐
[proteus simulation] 8-bit nixie tube dynamic scanning display change data
Comprehensive analysis of Seata distributed transaction at and XA
全面剖析Seata 分布式事务 AT 与XA
隐私计算助力数据的安全流通与共享
Redolog and binlog
关于onReachButton 不触发可能原因
Technology sharing | broadcast function design in integrated dispatching
The third sprint of Wei long La Tiao: the growth rate of performance declined, and Liu Weiping and Liu Fuping cashed out in advance
A simple but scalable feature normalization method
What memory consuming data is stored in MySQL CDC jobmanager?
GNN notes: message propagation model
Redis布隆过滤器和布谷鸟过滤器
Key wizard play monster learning - multi window and multi thread background judgment of character, pet blood volume and pet happiness
同样是做测试,为什么别人年薪30W+?
Sophon kg upgrade 3.1: break down barriers between data and liberate enterprise productivity
小程序在产业互联网有「大」作为
redolog和binlog
又拍云 Redis 的改进之路
Top the list for 10 consecutive years? What is the "most common" programming language for programmers?
资讯 | 扎克伯格被评为全球IT业最不谨慎的CEO;中国移动研发系留式无人机应急通信高空基站