当前位置:网站首页>使用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,繼續優化吧。。
边栏推荐
- Basics | draw arcs in the physics engine
- C language -- printf print base prefix
- 解题元宇宙,网络游戏中的多元通信方案
- Advanced MySQL - storage engine
- Sophon Base 3.1 推出MLOps功能,为企业AI能力运营插上翅膀
- UWB precise positioning scheme, centimeter level high-precision technology application, intelligent pairing induction technology
- [proteus simulation] progressive increase / decrease of nixie tube with flashing blanking display
- MySQL基础——事务
- Greedy Apple plans to raise the price of iphone14, which will provide opportunities for Chinese mobile phones
- 指南针开户炒股是否安全?个人怎样开户炒股
猜你喜欢

Tutorial | fNIRS data processing toolkit homer2 download and installation

Summary of common MySQL statements and commands

MySQL进阶——存储引擎

Technology sharing | broadcast function design in integrated dispatching

Sophon AutoCV:助力AI工业化生产,实现视觉智能感知

Sophon autocv: help AI industrial production and realize visual intelligent perception

GNN notes: message propagation model

Profil de risque de monnaie stable: l'usdt et l'USDC sont - ils sûrs?

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

After eight years of testing and opening experience and interview with 28K company, hematemesis sorted out high-frequency interview questions and answers
随机推荐
6.26CF模拟赛D:黑白条题题解
Apache atlas breakpoint view
Top the list for 10 consecutive years? What is the "most common" programming language for programmers?
Redis布隆过滤器和布谷鸟过滤器
华夏基金:基金行业数字化转型实践成果分享
After eight years of testing and opening experience and interview with 28K company, hematemesis sorted out high-frequency interview questions and answers
Science: the interrelated causes and consequences of sleep in the brain
It's also a test. Why do others get an annual salary of 30w+?
分片信息调哪个参数呢?用的是MySQLsource stream api,不是table api
Mathematical knowledge: finding combinatorial number II - finding combinatorial number
【 OpenGL 】 Random Talk 1. The camera rotates around a point in the space by dragging the mouse
【Proteus仿真】数码管+4x4键盘矩阵按键简易计算器
英联邦国家有哪些
隐私计算助力数据的安全流通与共享
Review of mathematical knowledge: curve integral of type I
What is the strength of a software testing engineer who can get a salary increase twice a year?
[proteus simulation] nixie tube +4x4 keyboard matrix key simple calculator
Real test = "half product + Half development"?
Graduates are confused and middle-aged people are anxious. How can the career path become wider and wider?
破解湖+仓混合架构顽疾,星环科技推出自主可控云原生湖仓一体平台