< >
Home » TK1入门教程软件篇 » TK1入门教程软件篇-安装iai_kinect2

TK1入门教程软件篇-安装iai_kinect2

TK1入门教程软件篇-安装iai_kinect2

说明:

步骤:

1) 安装Opencv2.4.8

  • 因为安装iai_kinect2需要2.4.8版本的opencv
  • 下载和编译2.4.8版本
$ cd ~
$ wget https://github.com/opencv/opencv/archive/2.4.8.tar.gz 
$ tar -zxvf 2.4.8.tar.gz 
$ cd ~/opencv-2.4.8
$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D CUDA_GENERATION=Kepler ..
$ make -j4
$ sudo make install 

2)安装iai_kinect2

  • 下载编译
$ mkdir -p kinect2_ws/src
$ cd kinect2_ws/src
$ git clone https://github.com/code-iai/iai_kinect2
$ rosdep install --from-paths . --ignore-src -r 
$ catkin_make -DCMAKE_BUILD_TYPE="Release"
  • 会出现问题:
No rule to make target `/usr/lib/arm-linux-gnueabihf/libopencv_videostab.so.2.4.8'
  • 此问题主要是对应目录没有相应的库,通过下面的脚本建立库的软连接。
  • 增加脚本changeLib.sh:
vim changeLib.sh
  • 脚本内容:
sudo ln -s /usr/lib/libopencv_calib3d.so /usr/lib/arm-linux-gnueabihf/libopencv_calib3d.so.2.4.8
sudo ln -s /usr/lib/libopencv_contrib.so /usr/lib/arm-linux-gnueabihf/libopencv_contrib.so.2.4.8
sudo ln -s /usr/lib/libopencv_core.so /usr/lib/arm-linux-gnueabihf/libopencv_core.so.2.4.8
sudo ln -s /usr/lib/libopencv_detection_based_tracker.so /usr/lib/arm-linux-gnueabihf/libopencv_detection_based_tracker.so.2.4.8
sudo ln -s /usr/lib/libopencv_esm_panorama.so /usr/lib/arm-linux-gnueabihf/libopencv_esm_panorama.so.2.4.8
sudo ln -s /usr/lib/libopencv_facedetect.so /usr/lib/arm-linux-gnueabihf/libopencv_facedetect.so.2.4.8
sudo ln -s /usr/lib/libopencv_features2d.so /usr/lib/arm-linux-gnueabihf/libopencv_features2d.so.2.4.8
sudo ln -s /usr/lib/libopencv_flann.so /usr/lib/arm-linux-gnueabihf/libopencv_flann.so.2.4.8
sudo ln -s /usr/lib/libopencv_gpu.so /usr/lib/arm-linux-gnueabihf/libopencv_gpu.so.2.4.8
sudo ln -s /usr/lib/libopencv_highgui.so /usr/lib/arm-linux-gnueabihf/libopencv_highgui.so.2.4.8
sudo ln -s /usr/lib/libopencv_imgproc.so /usr/lib/arm-linux-gnueabihf/libopencv_imgproc.so.2.4.8
sudo ln -s /usr/lib/libopencv_imuvstab.so /usr/lib/arm-linux-gnueabihf/libopencv_imuvstab.so.2.4.8
sudo ln -s /usr/lib/libopencv_legacy.so /usr/lib/arm-linux-gnueabihf/libopencv_legacy.so.2.4.8
sudo ln -s /usr/lib/libopencv_ml.so /usr/lib/arm-linux-gnueabihf/libopencv_ml.so.2.4.8
sudo ln -s /usr/lib/libopencv_objdetect.so /usr/lib/arm-linux-gnueabihf/libopencv_objdetect.so.2.4.8
sudo ln -s /usr/lib/libopencv_photo.so /usr/lib/arm-linux-gnueabihf/libopencv_photo.so.2.4.8
sudo ln -s /usr/lib/libopencv_stitching.so /usr/lib/arm-linux-gnueabihf/libopencv_stitching.so.2.4.8
sudo ln -s /usr/lib/libopencv_superres.so /usr/lib/arm-linux-gnueabihf/libopencv_superres.so.2.4.8
sudo ln -s /usr/lib/libopencv_tegra.so /usr/lib/arm-linux-gnueabihf/libopencv_tegra.so.2.4.8
sudo ln -s /usr/lib/libopencv_video.so /usr/lib/arm-linux-gnueabihf/libopencv_video.so.2.4.8
sudo ln -s /usr/lib/libopencv_videostab.so /usr/lib/arm-linux-gnueabihf/libopencv_videostab.so.2.4.8
sudo ln -s /usr/lib/libopencv_vstab.so /usr/lib/arm-linux-gnueabihf/libopencv_vstab.so.2.4.8

sudo ln -s /usr/lib/libopencv_ts.a /usr/lib/arm-linux-gnueabihf/libopencv_ts.so.2.4.8
sudo ln -s /usr/local/lib/libopencv_ocl.so.2.4.8 /usr/lib/arm-linux-gnueabihf/libopencv_ocl.so.2.4.8
  • 需要根据自己配置的opencv更改版本号以及路径
  • 如果顺利则能安装完成

3)测试iai_kinect2

  • 启动kinect2_bridge.launch
roslaunch kinect2_bridge kinect2_bridge.launch
  • 效果图:

请输入图片描述

  • 启动kinect2_viewer
rosrun kinect2_viewer kinect2_viewer kinect2 sd cloud
  • 效果图:

请输入图片描述

问题汇总:

  • 问题: 缺少libopencv_ts.so.2.4.8

ln链接libopencv_ts.a

  • 问题: 缺少libopencv_ocl.so.2.4.8

ln链接编译的版本

  • 问题:iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:436:28: error: expected type-specifier
    packetPipeline = new libfreenect2::CudaKdePacketPipeline(device);

直接修改kinect2_bridge.cpp,更改为libfreenect2::CudaPacketPipeline(device)

  • 问题:Unsupported gpu architecture 'compute_11'解决方法

http://blog.csdn.net/sysuwuhongpeng/article/details/45485719

  • 问题:opencv-2.4.8/modules/gpu/src/nvidia/core/NCVPixelOperations.hpp(51): error: a storage class is not allowed in an explicit specialization
    http://blog.csdn.net/solomon1558/article/details/51967280
    http://www.yanjiankang.cn/Linux-install-OpenCV-on-Ubuntu-or-Redhat/

  • 问题: [Debug] [RgbPacketStreamParser] skipping rgb packet!
    http://blog.csdn.net/ltflt/article/details/68065607
    https://github.com/OpenKinect/libfreenect2/issues/543
    https://elinux.org/Jetson/Performance
    https://github.com/OpenKinect/libfreenect2/issues/710
    https://github.com/OpenKinect/libfreenect2/issues/737

通过最大CPU性能解决
bin/Protenect cuda -noviewer

  • 问题:" No rule to make target `/usr/lib/arm-linux-gnueabihf/libopencv_videostab.so.2.4.8'.
    https://answers.ros.org/question/240739/using-opencv4tegra-in-ros/
    http://blog.csdn.net/u014629875/article/details/70197476
    https://devtalk.nvidia.com/default/topic/779315/jetson-tk1-opencv-and-ros/?offset=42
    https://devtalk.nvidia.com/default/topic/835118/embedded-systems/incorrect-configuration-in-opencv4tegra-debian-packages-and-solution
    http://myzharbot.robot-home.it/blog/software/ros-nvidia-jetson-tx1-jetson-tk1-opencv-ultimate-guide/
    http://www.zgxue.com/cblog/5284/52842099/gauxonz.html
    https://devtalk.nvidia.com/default/topic/900926/jetson-tx1/how-to-install-the-zed-ros-driver-on-the-jtx1/
  • 问题:kinect2_bridge/src/kinect2_bridge.cpp:427:28: error: expected type-specifier
    packetPipeline = new libfreenect2::OpenCLKdePacketPipeline(device);
    https://github.com/Nishida-Lab/motoman_project/issues/87

  • 问题:
    packetPipeline = new libfreenect2::CudaKdePacketPipeline(device);
    catkin_make -DCMAKE_BUILD_TYPE="Release" -Dfreenect2_DIR=~/freenect2/lib/cmake/freenect2

  • 问题:kinect2_viewer: Cannot locate rosdep definition for [kinect2_bridge]
    https://github.com/code-iai/iai_kinect2/issues/297

http://blog.csdn.net/windtalkersm/article/details/20067847
https://github.com/OpenPTrack/open_ptrack/wiki/Jetson-TK1-Installation
https://devtalk.nvidia.com/default/topic/811034/jetson-tk1/kinect-2-libfreenect2-hw-acceleration-full-performance-obtained/1

参考:

  • https://github.com/code-iai/iai_kinect2/tree/devel#install
  • https://github.com/opencv/opencv
  • https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.
  • http://blog.csdn.net/sunbibei/article/details/51594824

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: tk1入门教程软件篇, tk1