kinectv2 ubuntu环境配置

目录

一,官方教程下载安装libfreenect2

二,个人总结下载安装libfreenect2(ubuntu 18.04)


一,官方教程下载安装libfreenect2

        官方教程及源码:github地址

        微软没有为linx出专门的kinect SDK,但有大佬写了,并开源到了github上。(前排提醒,虚拟机用不了kinect,虚拟端口接受不了深度相机的数据。

        官方教程readme搬运

### Linux

Note: Ubuntu 12.04 is too old to support. Debian jessie may also be too old, and Debian stretch is implied in the following.

* Download libfreenect2 source
    ```
    git clone https://github.com/OpenKinect/libfreenect2.git
    cd libfreenect2
    ```
* (Ubuntu 14.04 only) Download upgrade deb files
    ```
    cd depends; ./download_debs_trusty.sh
    ```
* Install build tools
    ```
    sudo apt-get install build-essential cmake pkg-config
    ```
* Install libusb. The version must be >= 1.0.20.
    1. (Ubuntu 14.04 only) `sudo dpkg -i debs/libusb*deb`
    2. (Other) `sudo apt-get install libusb-1.0-0-dev`
* Install TurboJPEG
    1. (Ubuntu 14.04 to 16.04) `sudo apt-get install libturbojpeg libjpeg-turbo8-dev`
    2. (Debian/Ubuntu 17.10 and newer) `sudo apt-get install libturbojpeg0-dev`
* Install OpenGL
    1. (Ubuntu 14.04 only) `sudo dpkg -i debs/libglfw3*deb; sudo apt-get install -f`
    2. (Odroid XU4) OpenGL 3.1 is not supported on this platform. Use `cmake -DENABLE_OPENGL=OFF` later.
    3. (Other) `sudo apt-get install libglfw3-dev`
* Install OpenCL (optional)
    - Intel GPU
        1. (Ubuntu 14.04 only) `sudo apt-add-repository ppa:floe/beignet; sudo apt-get update; sudo apt-get install beignet-dev; sudo dpkg -i debs/ocl-icd*deb`
        2. (Other) `sudo apt-get install beignet-dev`
        3. For older kernels, `# echo 0 >/sys/module/i915/parameters/enable_cmd_parser` is needed. See more known issues at https://www.freedesktop.org/wiki/Software/Beignet/.
    - AMD GPU: Install the latest version of the AMD Catalyst drivers from https://support.amd.com and `apt-get install opencl-headers`.
    - Mali GPU (e.g. Odroid XU4): (with root) `mkdir -p /etc/OpenCL/vendors; echo /usr/lib/arm-linux-gnueabihf/mali-egl/libmali.so >/etc/OpenCL/vendors/mali.icd; apt-get install opencl-headers`.
    - Verify: You can install `clinfo` to verify if you have correctly set up the OpenCL stack.
* Install CUDA (optional, Nvidia only):
    - (Ubuntu 14.04 only) Download `cuda-repo-ubuntu1404...*.deb` ("deb (network)") from Nvidia website, follow their installation instructions, including `apt-get install cuda` which installs Nvidia graphics driver.
    - (Jetson TK1) It is preloaded.
    - (Nvidia/Intel dual GPUs) After `apt-get install cuda`, use `sudo prime-select intel` to use Intel GPU for desktop.
    - (Other) Follow Nvidia website's instructions. You must install the samples package.
* Install VAAPI (optional, Intel only)
    1. (Ubuntu 14.04 only) `sudo dpkg -i debs/{libva,i965}*deb; sudo apt-get install -f`
    2. (Other) `sudo apt-get install libva-dev libjpeg-dev`
    3. Linux kernels 4.1 to 4.3 have performance regression. Use 4.0 and earlier or 4.4 and later (Though Ubuntu kernel 4.2.0-28.33~14.04.1 has backported the fix).
* Install OpenNI2 (optional)
    1. (Ubuntu 14.04 only) `sudo apt-add-repository ppa:deb-rob/ros-trusty && sudo apt-get update` (You don't need this if you have ROS repos), then `sudo apt-get install libopenni2-dev`
    2. (Other) `sudo apt-get install libopenni2-dev`
* Build (if you have run `cd depends` previously, `cd ..` back to the libfreenect2 root directory first.)
    ```
    mkdir build && cd build
    cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/freenect2
    make
    make install
    ```
    You need to specify `cmake -Dfreenect2_DIR=$HOME/freenect2/lib/cmake/freenect2` for CMake based third-party application to find libfreenect2.
* Set up udev rules for device access: `sudo cp ../platform/linux/udev/90-kinect2.rules /etc/udev/rules.d/`, then replug the Kinect.
* Run the test program: `./bin/Protonect`
* Run OpenNI2 test (optional): `sudo apt-get install openni2-utils && sudo make install-openni2 && NiViewer2`. Environment variable `LIBFREENECT2_PIPELINE` can be set to `cl`, `cuda`, etc to specify the pipeline.

二,个人总结下载安装libfreenect2(ubuntu 18.04)

        1,下载源码,若git失败,则去源码地址手动下载

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

mkdir build

cd build

touch build.sh #用来储存安装依赖命令,编译命令

gedit build.sh  #编辑build.sh

        2,在build.sh添加以下内容

#安装相关依赖
sudo apt-get install build-essential cmake pkg-config libturbojpeg libjpeg-turbo8-dev mesa-common-dev libxrandr-dev libxi-dev libglfw3-dev libusb-1.0-0-dev libturbojpeg0-dev libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libglew-dev libgl1-mesa-glx libxmu-dev opencl-headers

#cmake 编译
cmake 	-DCMAKE_INSTALL_PREFIX= $HOME/freenect2\
	-Dfreenect2_DIR=$HOME/freenect2/lib/cmake/freenect2\
	..
make
sudo make install

sudo cp ../platform/linux/udev/90-kinect2.rules /etc/udev/rules.d/

        3,执行build.sh,等待一会,就安装完成了

./build

        4,测试,不知道为什么我的相机彩色通道是是反的,为RGB,使用的时候需要cvtcolor转换为BGR。

./bin/Protonect

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值