当前位置:网站首页>使用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,繼續優化吧。。
边栏推荐
- 「BUAA OO Unit 4 HW16」第四单元总结与课程回顾
- curl: (56) Recv failure: Connection reset by peer
- DAP大屏主题开发说明
- How to distinguish between instructions and data in the "group counting" CPU
- After reading the complete code
- GNN笔记:消息传播模型
- 小程序在产业互联网有「大」作为
- Sophon autocv: help AI industrial production and realize visual intelligent perception
- I, a tester from a large factory, went to a state-owned enterprise with a 50% pay cut. I regret it
- Picture and text show you how to thoroughly understand the atomicity of MySQL transaction undolog
猜你喜欢
STM32 key chattering elimination -- Thinking of entry state machine
数学知识:求组合数 II—求组合数
MySQL foundation - multi table query
C winfrom chart chart control bar chart and line chart
Privacy computing helps secure data circulation and sharing
同样是做测试,为什么别人年薪30W+?
Perhaps in two years, ASML will be free to supply EUV lithography machines to China
After studying this series of notes about software testing, it is a "bonus" to enter the factory
After eight years of testing and opening experience and interview with 28K company, hematemesis sorted out high-frequency interview questions and answers
A tour of gRPC:02 - 从proto生成代码
随机推荐
Key sprite fighting monsters - multi window and multi thread background skills
Advanced MySQL - storage engine
2022年有哪些适合穷人的理财产品?
Apache atlas breakpoint view
After reading the complete code
Redolog and binlog
Tencent cloud released the upgraded version of CDW Clickhouse to provide a fast experience for massive data real-time analysis scenarios
C language -- printf print base prefix
How to configure logback? 30 minutes for you to thoroughly learn the code to stay up late and knock
Practice | solution for image upload, rotation and compression on mobile terminal
C语言微博用户管理系统
UWB precise positioning scheme, centimeter level high-precision technology application, intelligent pairing induction technology
C11新特性——auto、decltype类型指示符
数学知识复习:第一型曲线积分
Sophon KG升级3.1:打破数据间壁垒,解放企业生产力
CompletableFuture的入门
iNFTnews | Meta在元宇宙中的后续计划会是什么?
InheritableThreadLocal 在线程池中进行父子线程间消息传递出现消息丢失的解析
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
真正的测试 =“半个产品+半个开发”?