当前位置:网站首页>使用kalibr標定工具進行單目相機和雙目相機的標定
使用kalibr標定工具進行單目相機和雙目相機的標定
2022-06-29 16:42: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,繼續優化吧。。
边栏推荐
- 真正的测试 =“半个产品+半个开发”?
- InheritableThreadLocal 在线程池中进行父子线程间消息传递出现消息丢失的解析
- 腾讯云发布CDW ClickHouse升级版,为海量数据实时分析场景提供极速体验
- Metadata management Apache Atlas Compilation integration deployment and testing
- [proteus simulation] nixie tube +4x4 keyboard matrix key simple calculator
- 6.25AtCoderABC257E - Addition and Multiplication 2题解
- Interviewer: tell me about the MySQL transaction isolation level?
- C language -- printf print base prefix
- CompletableFuture的入门
- GNN笔记:消息传播模型
猜你喜欢

Sophon kg upgrade 3.1: break down barriers between data and liberate enterprise productivity

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

我,大厂测试员,降薪50%去国企,后悔了...

或许再过两年,ASML将可以自由给中国供应EUV光刻机

How to configure logback? 30 minutes for you to thoroughly learn the code to stay up late and knock

Comprehensive analysis of Seata distributed transaction at and XA

curl: (56) Recv failure: Connection reset by peer

Interviewer: tell me about the MySQL transaction isolation level?

Cortical traceability analysis of ERP

I, a tester from a large factory, went to a state-owned enterprise with a 50% pay cut. I regret it
随机推荐
Telnet+ftp to control and upgrade the equipment
Flutter技术与实战(1)
Information | Zuckerberg was rated as the most careless CEO in the global IT industry; China Mobile R & D tethered UAV emergency communication high altitude base station
如何利用OpenMesh实现不同格式的3D文件间的转换
C语言微博用户管理系统
一个简单但是能上分的特征标准化方法
把这份关于软件测试一系列笔记研究完,进大厂是个“加分项”...
「科普大佬说」AI与创造力
TLBB series of Tianlong Babu - online single use database modified to other sects
iNFTnews | Meta在元宇宙中的后续计划会是什么?
MySQL cdc jobmanager 中存了哪些比较耗内存的数据呢?
毕业生迷茫,中年人焦虑,职场路怎么越走越宽?
6.26CF模拟赛D:黑白条题题解
STM32按键消抖——入门状态机思维
MySQL foundation - transaction
curl: (56) Recv failure: Connection reset by peer
What are the top level Chinese programmers?
Redis布隆过滤器和布谷鸟过滤器
[proteus simulation] 8-bit nixie tube dynamic scanning display change data
关于XAMPP无法启动mysql数据库