1.安装依赖
见下面列表:(引自:https://github.com/OpenKinect/libfreenect2)
Requirements for optional features
- OpenGL depth processing: OpenGL 3.1 (Windows, Linux, Mac OS X). OpenGL ES is not supported at the moment.
- OpenCL depth processing: OpenCL 1.1
- CUDA depth processing: CUDA (6.5 and 7.5 are tested; The minimum version is not clear.)
- VAAPI JPEG decoding: Intel (minimum Ivy Bridge or newer) and Linux only
- VideoToolbox JPEG decoding: Mac OS X only
- OpenNI2 integration: OpenNI2 2.2.0.33
- Jetson TK1: Linux4Tegra 21.3 or later. Check Jetson TK1 issues before installation. Jetson TX1 is not yet supported as the developers don't have one, but it may be easy to add the support.
上述以来可以通过pacman或yaourt安装。
2.安装libfreenect2
我尝试通过yaourt安装,不好用,所以通过编译安装:
首先需要安装gcc5,直接通过pacman安装(为什么是gcc5,因为libfreenect2需要gcc7以下的版本编译,而且gcc4、gcc6只能通过AUR安装,安装速度很慢)
git clone https://github.com/OpenKinect/libfreenect2.git
cd libfreenect2
编译之前创建并进入build目录:
mkdir build && cd build
接下来进行编译,切换到使用gcc5("/usr/bin/gcc-5"、"/usr/bin/g++-5"是两个目录,确保是有这个目录才行)
export CC=/usr/bin/gcc-5
export CXX=/usr/bin/g++-5
make
sudo make install
3.测试
接好设备(USB 3.0)
sudo ./bin/Protonect
不出意外会显示设备拍出来的实时画面。
附:OpenNI2 安装:
git clone https://github.com/occipital/OpenNI2.git
sudo ./OpenNI2/Packaging/Linux/install.sh
之后会出现 OpenNIDevEnvironment文件在下面目录,进入该目录:
cd ./OpenNI2/Packaging/Linux/
source OpenNIDevEnvironment
sudo cp ./primesense-usb.rules /etc/udev/rules.d/