官方文档:
libfreenect2:https://github.com/OpenKinect/libfreenect2
iai_kinect2:https://github.com/code-iai/iai_kinect2#opencl-with-amd
libfreenect2
下载文件
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.
- (Ubuntu 14.04 only)
sudo dpkg -i debs/libusb*deb
- (Other)
sudo apt-get install libusb-1.0-0-dev
- (Ubuntu 14.04 only)
- Install TurboJPEG
- (Ubuntu 14.04 to 16.04)
sudo apt-get install libturbojpeg libjpeg-turbo8-dev
- (Debian/Ubuntu 17.10 and newer)
sudo apt-get install libturbojpeg0-dev
- (Ubuntu 14.04 to 16.04)
- Install OpenGL
- (Ubuntu 14.04 only)
sudo dpkg -i debs/libglfw3*deb; sudo apt-get install -f
- (Odroid XU4) OpenGL 3.1 is not supported on this platform. Use
cmake -DENABLE_OPENGL=OFF
later. - (Other)
sudo apt-get install libglfw3-dev
- (Ubuntu 14.04 only)
- Install OpenCL (optional)
- Intel GPU
- (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
- (Other)
sudo apt-get install beignet-dev
- 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/.
- (Ubuntu 14.04 only)
- 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.
- Intel GPU
- Install CUDA (optional, Nvidia only):
- (Ubuntu 14.04 only) Download
cuda-repo-ubuntu1404...*.deb
("deb (network)") from Nvidia website, follow their installation instructions, includingapt-get install cuda
which installs Nvidia graphics driver. - (Jetson TK1) It is preloaded.
- (Nvidia/Intel dual GPUs) After
apt-get install cuda
, usesudo prime-select intel
to use Intel GPU for desktop. - (Other) Follow Nvidia website's instructions. You must install the samples package.
- (Ubuntu 14.04 only) Download
- Install VAAPI (optional, Intel only)
- (Ubuntu 14.04 only)
sudo dpkg -i debs/{libva,i965}*deb; sudo apt-get install -f
- (Other)
sudo apt-get install libva-dev libjpeg-dev
- 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).
- (Ubuntu 14.04 only)
- Install OpenNI2 (optional)
- (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), thensudo apt-get install libopenni2-dev
- (Other)
sudo apt-get install libopenni2-dev
- (Ubuntu 14.04 only)
- Build (if you have run
cd depends
previously,cd ..
back to the libfreenect2 root directory first.)
You need to specifymkdir build && cd build cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/freenect2 make make install
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 variableLIBFREENECT2_PIPELINE
can be set tocl
,cuda
, etc to specify the pipeline.
安装iai_kinect2
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"