当前位置:网站首页>使用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,继续优化吧。。
边栏推荐
- New feature of C11 - Auto and decltype type type indicators
- 小程序在产业互联网有「大」作为
- Apache atlas breakpoint view
- curl: (56) Recv failure: Connection reset by peer
- Why does selenium become the first choice for web automated testing? (source code attached)
- 实践 | 脚本错误量极致优化-让脚本错误一目了然
- 2022年有哪些适合穷人的理财产品?
- [proteus simulation] 8-bit nixie tube dynamic scanning display change data
- 都3年测试经验了,用例设计还不知道状态迁移法?
- Comprehensive analysis of Seata distributed transaction at and XA
猜你喜欢

GNN notes: message propagation model

能够1年涨薪2次的软件测试工程师,他到底强在哪里?

关于XAMPP无法启动mysql数据库

图文带你彻底弄懂MySQL事务原子性之UndoLog

论文笔记:E(n) Equivariant Graph Neural Networks

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

Selenium 凭什么成为 Web 自动化测试的首选?(内附源码)

数学知识复习:第一型曲线积分

【OpenGL】杂谈一、通过鼠标拖拽实现相机绕空间中的某点进行球面旋转查看

Tutorial | fNIRS data processing toolkit homer2 download and installation
随机推荐
redolog和binlog
Sophon KG升级3.1:打破数据间壁垒,解放企业生产力
InheritableThreadLocal 在线程池中进行父子线程间消息传递出现消息丢失的解析
Flutter技术与实战(2)
Cerebral cortex: predicting children's mathematical skills from task state and resting state brain function connections
同样是做测试,为什么别人年薪30W+?
Telnet+ftp to control and upgrade the equipment
分片信息调哪个参数呢?用的是MySQLsource stream api,不是table api
资讯 | 扎克伯格被评为全球IT业最不谨慎的CEO;中国移动研发系留式无人机应急通信高空基站
Interviewer: tell me about the MySQL transaction isolation level?
Flutter technology and Practice (1)
New feature of C11 - Auto and decltype type type indicators
Flutter技术与实战(1)
真正的测试 =“半个产品+半个开发”?
能够1年涨薪2次的软件测试工程师,他到底强在哪里?
元代理模型可迁移对抗攻击
美国芯片再遭重击,Intel或将被台积电击败而沦落至全球第三
MATLAB输出格式控制 %d,%f,%c,%s的用法
SAAS服务都有哪些优势
关于XAMPP无法启动mysql数据库