使用iai_kinect2標定kinectV2相機

實驗背景:因為需要制作bundlefusion需要的數據集,所以需要使用kinectV2相機獲取rgbd圖像,年前的時候在我的筆記本上安裝了libfreenect2庫和iai_kinect2,標定過一次kinecv2相機,然后使用kinectv2相機實時獲取的圖像實現elasticfusion稠密重建.但是由于當時時間緊迫,很多東西都沒有搞明白,所以趁這次機會將一些問題整理一下,記錄一下.

環境搭建:

1. 安裝了ROS的kinetic版本

libfreenect2和iai_kinect2的安裝參考文章: https://www.cnblogs.com/li-yao7758258/p/7445429.html

2. 下載libfreenect2

$ cd Downloads
$ git clone https://github.com/OpenKinect/libfreenect2.git

3.安裝libfreenect2的依賴

sudo apt-get install build-essential cmake pkg-config libturbojpeg libjpeg-turbo8-dev mesa-common-dev freeglut3-dev libxrandr-dev libxi-dev安裝libusb
sudo apt-add-repository ppa:floe/libusb
sudo apt-get update
sudo apt-get install libusb-1.0-0-dev安裝GLFW3
cd libfreenect2/depends 
sh install_ubuntu.sh
sudo dpkg -i libglfw3*_3.0.4-1_*.deb

4.? 繼續安裝libfreenect2庫

$ cd libfreenect2
$ mkdir build 
$ cmake ../
$ make -j4
$ sudo make install

5. 使用lsusb指令測試kinectv2相機有沒有鏈接成功.

6. 編譯iai_kinect2

$ cd ~/ROS  #在/home/yunlei下創建了一個ROS文件夾,專門盛放ros的工程
$ mkdir -r ./iai_kinect2_ws/src/
$ cd ./iai_kinect2/src
$ git clone https://github.com/code-iai/iai_kinect2.git
$ cd iai_kinect2
$ rosdep install -r --from-paths .
$ cd ~/ROS/iai_kinect2
$ catkin_make -DCMAKE_BUILD_TYPE="Release"
$ rospack profile

7. 測試kinectv2相機是否鏈接成功

$ cd Download
$ cd libfreenect
$ cd build/bin
$ ./Protonect

如果一切正常的話,相機拍攝的畫面將映入眼簾.?

?8. 測試kinectv2圖像數據

$ cd ~/ROS/iai_kinect2_ws
$ source ./devel/setup.bash
$ roslaunch kinect2_bridge kinect2_bridge.launch# open a new terminal
$  rosrun kinect2_viewer kinect2_viewer(但是我這里執行失敗) 

9. 查看此時發布的與kinect相關的topics

/kinect2/bond
/kinect2/hd/camera_info
/kinect2/hd/image_color
/kinect2/hd/image_color/compressed
/kinect2/hd/image_color_rect
/kinect2/hd/image_color_rect/compressed
/kinect2/hd/image_depth_rect
/kinect2/hd/image_depth_rect/compressed
/kinect2/hd/image_mono
/kinect2/hd/image_mono/compressed
/kinect2/hd/image_mono_rect
/kinect2/hd/image_mono_rect/compressed
/kinect2/hd/points
/kinect2/qhd/camera_info
/kinect2/qhd/image_color
/kinect2/qhd/image_color/compressed
/kinect2/qhd/image_color_rect
/kinect2/qhd/image_color_rect/compressed
/kinect2/qhd/image_depth_rect
/kinect2/qhd/image_depth_rect/compressed
/kinect2/qhd/image_mono
/kinect2/qhd/image_mono/compressed
/kinect2/qhd/image_mono_rect
/kinect2/qhd/image_mono_rect/compressed
/kinect2/qhd/points
/kinect2/sd/camera_info
/kinect2/sd/image_color_rect
/kinect2/sd/image_color_rect/compressed
/kinect2/sd/image_depth
/kinect2/sd/image_depth/compressed
/kinect2/sd/image_depth_rect
/kinect2/sd/image_depth_rect/compressed
/kinect2/sd/image_ir
/kinect2/sd/image_ir/compressed
/kinect2/sd/image_ir_rect
/kinect2/sd/image_ir_rect/compressed
/kinect2/sd/points

10. 打開/home/yunlei/ROS/iai_kinect2_ws/src/iai_kinect2/kinect2_bridge/launch/kinect2_bridge.launch查看kinect相機的分辨率

 <!-- sd point cloud (512 x 424) --><node pkg="nodelet" type="nodelet" name="$(arg base_name)_points_xyzrgb_sd" machine="$(arg machine)"args="load depth_image_proc/point_cloud_xyzrgb $(arg nodelet_manager)" respawn="$(arg respawn)"><remap from="rgb/camera_info"             to="$(arg base_name)/sd/camera_info"/><remap from="rgb/image_rect_color"        to="$(arg base_name)/sd/image_color_rect"/><remap from="depth_registered/image_rect" to="$(arg base_name)/sd/image_depth_rect"/><remap from="depth_registered/points"     to="$(arg base_name)/sd/points"/><param name="queue_size" type="int" value="$(arg queue_size)"/></node><!-- qhd point cloud (960 x 540) --><node pkg="nodelet" type="nodelet" name="$(arg base_name)_points_xyzrgb_qhd" machine="$(arg machine)"args="load depth_image_proc/point_cloud_xyzrgb $(arg nodelet_manager)" respawn="$(arg respawn)"><remap from="rgb/camera_info"             to="$(arg base_name)/qhd/camera_info"/><remap from="rgb/image_rect_color"        to="$(arg base_name)/qhd/image_color_rect"/><remap from="depth_registered/image_rect" to="$(arg base_name)/qhd/image_depth_rect"/><remap from="depth_registered/points"     to="$(arg base_name)/qhd/points"/><param name="queue_size" type="int" value="$(arg queue_size)"/></node><!-- hd point cloud (1920 x 1080) --><node pkg="nodelet" type="nodelet" name="$(arg base_name)_points_xyzrgb_hd" machine="$(arg machine)"args="load depth_image_proc/point_cloud_xyzrgb $(arg nodelet_manager)" respawn="$(arg respawn)"><remap from="rgb/camera_info"             to="$(arg base_name)/hd/camera_info"/><remap from="rgb/image_rect_color"        to="$(arg base_name)/hd/image_color_rect"/><remap from="depth_registered/image_rect" to="$(arg base_name)/hd/image_depth_rect"/><remap from="depth_registered/points"     to="$(arg base_name)/hd/points"/><param name="queue_size" type="int" value="$(arg queue_size)"/>

可以發現kinecv2相機可以直接獲取的圖像的分辨率有三個,分別是:hd(1920x1080), qhd(960x540), sd(512x424),每一種分辨率又對應了彩色圖,灰度圖,深度圖,以及是否是經過去畸變處理的,深度圖是否和彩色圖配準.

11. 如果你想獲取rect圖像,那么你需要給定相應分辨率的相機內參數,而此時使用的是默認/iai_kinect2/kinect2_bridge/data下的相機參數,所以你需要標定你需要的分辨率的相機參數.

12.關于數據獲取,如果我標定了960x540的相機內參數,獲取了去畸變后的而圖像,我直接使用rosbag record指令,錄制相應的topic就可以了.所以現在最關鍵的是標定相機

13. iai_kinect2中也提供了標定工具,在/home/yunlei/ROS/iai_kinect2_ws/src/iai_kinect2/kinect2_calibration中,不過此時在/home/yunlei/ROS/iai_kinect2_ws/src/iai_kinect2/kinect2_calibration/src/kinect2_calibration.cpp文件中默認是標定1920x1080的圖像,如果想要標定960x540的相機內參數,則需要將文件1349行中的HD改為QHD

將原來的

std::string topicColor = "/" + ns + K2_TOPIC_HD + K2_TOPIC_IMAGE_MONO;
std::string topicIr = "/" + ns + K2_TOPIC_SD + K2_TOPIC_IMAGE_IR;
std::string topicDepth = "/" + ns + K2_TOPIC_SD + K2_TOPIC_IMAGE_DEPTH;

改為?

std::string topicColor = "/" + ns + K2_TOPIC_QHD + K2_TOPIC_IMAGE_MONO;
std::string topicIr = "/" + ns + K2_TOPIC_SD + K2_TOPIC_IMAGE_IR;
std::string topicDepth = "/" + ns + K2_TOPIC_SD + K2_TOPIC_IMAGE_DEPTH;

我剛開始改成了SD但是這種情況下,當你執行rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 record color指令時,沒有彈出圖像窗口,無法保存圖像,并且提示

[ERROR] Tried to advertise a service that is already advertised in this node [/kinect2_calib_1591865100768222736/compressed/set_parameters]
[ERROR] Tried to advertise a service that is already advertised in this node [/kinect2_calib_1591865100768222736/compressed/set_parameters]

我剛開始根據這個錯誤提示去搜索出了什么問題,但是有網友說這個不影響標定,(https://blog.csdn.net/weixin_30536513/article/details/94969881)但是我這里確實影響了.我折騰了好久,但是還是沒有解決這個問題,當我想放棄的時候,突然想起來,我可以把上面的SD改為QHD試試.果然,當我改成了QHD后發現,雖然還是會有上面的錯誤的提示,但是此時彈出了圖像窗口,當我拿著標定板進入相機的視野時,他可以檢測到標定板子上的特征點,哇,我好開心.

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/252418.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/252418.shtml
英文地址,請注明出處:http://en.pswp.cn/news/252418.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

tar只解壓tar包中某個文件

如果tar包很大&#xff0c;而只想解壓出其中某個文件。方法如下&#xff1a; 只想解壓出Redis-1.972.tar 中的Changes文件&#xff0c;來查看有哪些更改。 [rootuplooking]# tar -tf Redis-1.972.tar Redis-1.972…

扎克伯格的中文夜:想要成功就不能放棄

10月23日消息。雖然并不太流暢。昨天馬克?扎克伯格依舊用中文與清華經管學院主持人完畢了一場對話&#xff1b;在對話中&#xff0c;這位Facebook創始人兼首席運行官闡述了自己學習中文的原因&#xff1a;想要和太太&#xff08;普里西拉?陳&#xff09;的家人交流&#xff1…

python將ros下bag文件的所有topic解析為csv格式

背景&#xff1a;最近在制作kimera的數據集&#xff0c;尤其是運行semantic模塊所需要的bag文件中有很多topic&#xff0c;但是很多不知道topic中裝的是什么數據&#xff0c;及其格式&#xff0c;所以我就想著怎么可以將bag中的topic都解析數來&#xff0c;這樣就能知道bag中都…

十九. Python基礎(19)--異常

十九. Python基礎(19)--異常 1 ● 捕獲異常 if VS異常處理: if是預防異常出現, 異常處理是處理異常出現 異常處理一般格式: try: <...............> #可能得到異常的語句 except <.......>: #捕獲是哪種異常 <...............> #出現異常的處理方…

洛谷1052——過河(DP+狀態壓縮)

題目描述 在河上有一座獨木橋&#xff0c;一只青蛙想沿著獨木橋從河的一側跳到另一側。在橋上有一些石子&#xff0c;青蛙很討厭踩在這些石子上。由于橋的長度和青蛙一次跳過的距離都是正整數&#xff0c;我們可以把獨木橋上青蛙可能到達的點看成數軸上的一串整點&#xff1a;0…

Tensorflow學習教程------tfrecords數據格式生成與讀取

首先是生成tfrecords格式的數據&#xff0c;具體代碼如下&#xff1a; #coding:utf-8import os import tensorflow as tf from PIL import Imagecwd os.getcwd() 此處我加載的數據目錄如下&#xff1a; bt -- 14018.jpg14019.jpg14020.jpgnbt -- 1_ddd.jpg1_dsdfs.jpg1_dfd.…

ROS獲取KinectV2相機的彩色圖和深度圖并制作bundlefusion需要的數據集

背景&#xff1a; 最近在研究BundleFusion&#xff0c;跑通官方數據集后&#xff0c;就想著制作自己的數據集來運行bundlefusion&#xff0e;KinectV2相機可直接獲取的圖像的分辨率分為三個HD 1920x1080, QHD: 960X540&#xff0c;SD: 512x424.我選擇是中間的分辨率qhd. 錄制…

Linux下配置tomcat+apr+native應對高并發

摘要&#xff1a;在慢速網絡上Tomcat線程數開到300以上的水平&#xff0c;不配APR&#xff0c;基本上300個線程狠快就會用滿&#xff0c;以后的請求就只好等待。但是配上APR之后&#xff0c;Tomcat將以JNI的形式調用Apache HTTP服務器的核心動態鏈接庫來處理文件讀取或網絡傳輸…

Firefox 66 將阻止自動播放音頻和視頻

百度智能云 云生態狂歡季 熱門云產品1折起>>> 當我們點擊一個鏈接&#xff0c;或者打開新的瀏覽器選項卡時&#xff0c;瀏覽器就開始自動播放視頻和聲音&#xff0c;這是一件十分煩人的事。Chrome 瀏覽器早已對這些行為下手了&#xff0c;現在 Firefox 也明確表示要…

Windows 10 關閉Hyper-V

以管理員身份運行命令提示符 關閉 bcdedit /set hypervisorlaunchtype off 啟用 bcdedit / set hypervisorlaunchtype auto 禁用DG 轉載于:https://www.cnblogs.com/Robbery/p/8397767.html

ROS下獲取kinectv2相機的仿照TUM數據集格式的彩色圖和深度圖

準備工作&#xff1a; &#xff11;&#xff0e; ubuntu16.04上安裝iai-kinect2, 2. 運行roslaunch kinect2_bridge kinect2_bridge.launch, 3. 運行 rosrun save_rgbd_from_kinect2 save_rgbd_from_kinect2,開始保存圖像&#xff0e; 這個保存kinectV2相機的代碼如下&…

Java Web 九大內置對象(一)

在Jsp 中一共定義了九個內置對象&#xff0c;分別為&#xff1a; *request HttpServletRequest; *response HttpServletResponse; *session HttpSession; page This(本jsp頁面)&#xff1b; *application ServletCon…

Missing URI template variable 'XXXX' for method parameter of type String

原因&#xff1a;就是spring的controller上的RequestMapping的實參和方法里面的形參名字不一致 方法&#xff1a;改成一樣就可。 ps.還能用綁定的方法&#xff0c;不建議&#xff0c;因為太麻煩了 RequestMapping(value "/findUser/{id}",method RequestMethod.GET…

css:text-overflow屬性

參考文檔:www.w3school.com.cn/cssref/pr_t… text-overflow:ellipsis;( 顯示省略符號來代表被修剪的文本。)

Failed to load nodelet ‘/kinect2_bridge` of type `kinect2_bridge/kinect2_bridge_nodelet` to manager

之前在我的電腦上配置了libfreenect2和iai_kinect2&#xff0c;現在需要在工控機上重新安裝這兩個庫&#xff0c;講kinectV2相機安置在嬰兒車上&#xff0c;然后使用我的ros下獲取kinectV2相機的彩色圖和灰度圖的腳本&#xff0c;獲取深度圖和彩色圖。 我成功的安裝了libfreen…

object轉字符串

1、obj.tostring() obj為空時&#xff0c;拋異常。 2、convert.tostring(obj) obj為空時&#xff0c;返回null&#xff1b; 3、(string)obj obj為空時&#xff0c;返回null&#xff1b;obj不是string類型時&#xff0c;拋異常。 4、obj as string obj為空時&#xff0c;返回nul…

微信開發中,H5的video標簽使用

<video></video>是HTML5新加入的標簽&#xff0c;最近流行的h5開發多以video技術集成一個H5頁面&#xff0c;效果也是很6的。現在總結一下用到的技術&#xff0c;主要的使用環境是微信&#xff0c;部分屬性一些手機的默認瀏覽器不支持&#xff0c;這些還需要讀者親…

bundlefusion論文閱讀筆記

4. 全局位姿對齊(glob pose alignment) 輸入系統的是使用消費級的傳感器獲取的RGBD數據流&#xff0c;并且保證這些數據中的彩色圖像和深度圖像是時間和空間上都對齊的。圖像分辨率是640x480,頻率是30hz。我們的目的就是要找到frames之間的3D對應&#xff0c;然后根據這些對應…

IOC和DI的區別詳解

IOC 是英文inversion of control的縮寫&#xff0c;意思是控制反轉DI 是英文Dependency Injection的縮寫&#xff0c;意思是依賴注入 下面用一個簡單的例子來描述一下IOC和DI的關系 先看下總結&#xff1a; 依賴注入(DI)和控制反轉(IOC)是從不同的角度的描述的同一件事情&#…

TOMCAT啟動到一半停止如何解決

當你的項目過大的時候&#xff0c;往往會導致你的TOMCAT啟動時間過長&#xff0c;啟動失敗&#xff0c;遇到該情況可以試一下下面兩招&#xff1a; TOmcat啟動到一半的時候停止了&#xff0c;以下原因&#xff1a; 1、 tomcat啟動時間超過了設置時間&#xff1a; 解決辦法&…