日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

kinect2的标定

發布時間:2024/9/5 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 kinect2的标定 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

我用的是ubuntu14.04LTS,ROS 版本是indigo,kinect v2,我是用雙系統裝的ubuntu,關于怎么使用安裝kinect2的安裝以及使用的都在github上有著詳細的說明

Kinect2 開源驅動:libfreenect2

kinect2--> ros的bridge:iai_kinect2

安裝
安裝libfreenect2,這個libfreenect2據說是它的驅動包,希望是穩定的,放在home目錄下; git clone https://github.com/OpenKinect/libfreenect2.git 安裝好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 不要用sudo apt-get install安裝glfw3,但可以用sudo?apt-get?remove?libglfw3-dev卸載它。
所有以包形式安裝的包都可以sudo apt-get remove來卸載它
接著編譯庫 cd .. mkdir build && cd build cmake .. make sudo make install
這時候插上kinect的數據線
運行lsusb,如果下面出現Bus 002 Device 003: ID 045e:02c4 Microsoft Corp.
Bus 002 Device 002: ID 045e:02d9 Microsoft Corp. 就說明連上了。
運行 ? ./bin/Protonect 如果提示no device connected,是因為你的虛擬機默認設置是接usb2.0的口,而kinect v2要接usb3.0的口,所以要做出更改,但是用虛擬機裝的ubuntu是連不上kinect的。

如果是要重裝或是重新編譯libfreenect2,則 cd sudo?rm?-rf?/usr/local/include/libfreenect2
cd?/usr/local/lib
sudo?rm?-rf?libfreenect2.so?libfreenect2.so.0.2?libfreenect2.so.0.2.0
cd?OpenNI2/Drivers sudo?rm?-rf?libfreenect2-openni2.so??libfreenect2-openni2.so.0
ROS接口安裝 對于已經安裝了Ros Indigo的Ubuntu14.04來說,使用下面的命令
cd ~/catkin_ws/src/ git clone https://github.com/code-iai/iai_kinect2.git cd iai_kinect2 rosdep install -r --from-paths .

cd ~/catkin_ws catkin_make -DCMAKE_BUILD_TYPE="Release" rospack profile ?
rosdep install -r --from-paths .這一步可能會報錯,但這個報錯是正常的,不用管,不會影響最終結果。

接下來可以測試了。

新打開一個終端,運行

cd?~/catkin_ws/
catkin_make
source?./devel/setup.bash
cd?src roslaunch kinect2_bridge kinect2_bridge.launch
獲取Kinect數據

再新打開一個終端,運行

rosrun kinect2_viewer kinect2_viewer

就可以正常顯示圖像了

?

?

一般在使用前 ,我們都會矯正,就是所謂的計算相機的內外參數,一般使用的方法都是張正友標定法的理論,理論知識就不在贅述,其實當時看都是能看懂的一旦讓自己完全從頭推理就懵逼了

首先呢我們的矯正步驟就是,我們得有標定模板,這如果你之前下載了iai_kinect2在kinect2_calibration文件下是有標定模板的? 你可以隨意打印一個模板等著后期的標定使用

那么我就按照github的教程教你如果去矯正kinect2? 以下 就是github給出的具體的步驟,對于其中的參數我們一般按照要求給就OK了,對于kienct 2的標定并不需要說把紅外發射器給遮住? 然后使用紅外LED去矯正的,這是針對kinect1的,之前我矯正過kinect1? 確實是需要把紅外發射裝置給遮住,然后才能矯正深度信息,

Detailed steps:

  • If you haven't already, start the kinect2_bridge with a low number of frames per second (to make it easy on your CPU): rosrun kinect2_bridge kinect2_bridge _fps_limit:=2? (這一步就是要啟動ROS的kienct 2的驅動貨都kienct2的原始數據)
  • create a directory for your calibration data files, for example: mkdir ~/kinect_cal_data; cd ~/kinect_cal_data(這是為了創建一個文件,存儲我們用于矯正的照片)
  • Record images for the color camera: rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 record color?? (這命令就是開始矯正深度相機的RGB相機,對于后面的參數我們可以知道chess5x7x0.03(是棋盤的大小? 可以用尺子量一下的) record(記錄保存下下) color)
  • Calibrate the intrinsics: rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate color
  • Record images for the ir camera: rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 record ir
  • Calibrate the intrinsics of the ir camera: rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate ir
  • Record images on both cameras synchronized: rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 record sync
  • Calibrate the extrinsics: rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate sync
  • Calibrate the depth measurements: rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate depth
  • Find out the serial number of your kinect2 by looking at the first lines printed out by the kinect2_bridge. The line looks like this: device serial: 012526541941
  • Create the calibration results directory in kinect2_bridge/data/$serial: roscd kinect2_bridge/data; mkdir 012526541941
  • Copy the following files from your calibration directory (~/kinect_cal_data) into the directory you just created: calib_color.yaml calib_depth.yaml calib_ir.yaml calib_pose.yaml
  • Restart the kinect2_bridge and be amazed at the better data.
  • 還要好多就不在寫了

    通常遇到最多的就是這種問題,但是這個問題并不影響我們的矯正

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

    真正影響我們的是我們輸入的參數? 比如ROS的開發包給例子是使用棋盤格6*8的棋盤,正方形的邊長為0.03米? 但是我們的棋盤可能并并不是那么小的,這時候要使用我們的

    棋盤的話就要注意給的參數了。比如用的是長有9個,款有7個正方形的標定棋盤,這時候我們的參數是6*8*0.05,參數一定要給準確,不然會出現錯誤的 啊、

    而且就是在同一個文件下使用命令,

    ?

    轉載于:https://www.cnblogs.com/li-yao7758258/p/7445429.html

    總結

    以上是生活随笔為你收集整理的kinect2的标定的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。