|
libfreenect2 0.4
Open source driver for the Kinect for Windows v2 (K4W2) sensor
|
This is the reference install path for Linux. For a condensed version see the README.
Minimum supported release: Ubuntu 22.04 LTS (Jammy Jellyfish) or the equivalent Debian. Package names below are for Jammy and newer; adapt them for other distributions.
| Tier | Platforms |
|---|---|
| Tested | Ubuntu 24.04 (CI: GCC and Clang, shared and static, filter backends, VAAPI, sanitizers, fuzzers, coverage) |
| Expected to work | Ubuntu 22.04 LTS and newer; Debian 12 and newer; other current distributions with libusb ≥ 1.0.20 and kernel ≥ 5.15 |
| Unsupported | Ubuntu 20.04 and older, Debian 11 and older, any USB 2 host, virtual machines, 32-bit ARM Jetson TK1/TX1 |
Older releases are not blocked by the build system, but they are not tested and their optional-backend packages (notably Beignet, which was removed from Ubuntu after 18.04) no longer exist.
Virtual machines usually do not work, because USB 3.0 isochronous transfer is delicate.
Cloning OpenKinect/libfreenect2 instead gets you upstream, which has none of the 0.4 APIs described in the guides.
OpenGL 3.1 is required. On platforms that lack it, configure with -DENABLE_OPENGL=OFF. OpenGL ES is not supported.
Install the ICD loader and development headers, then a vendor runtime:
| Vendor | Package |
|---|---|
| Intel (Gen8+) | intel-opencl-icd — the NEO compute runtime. Beignet, the pre-18.04 Intel stack, no longer exists in Ubuntu. |
| AMD | mesa-opencl-icd for the open stack, or AMD's ROCm packages. The Catalyst driver referenced by older guides is discontinued. |
| NVIDIA | Provided by the proprietary driver package |
Verify the stack independently of libfreenect2 before suspecting the driver:
If clinfo reports no platforms, libfreenect2 will skip the OpenCL pipelines — that is a driver problem, not a libfreenect2 one.
Follow NVIDIA's toolkit and driver instructions for your distribution. The CUDA samples package is not required — the cuda and cuda_kde pipelines depend only on CUDA Toolkit headers and libraries, and CMake does not search sample installation paths.
On a machine with an NVIDIA GPU:
On a GPU-less build host or container, specify the target architecture explicitly, for example -DCMAKE_CUDA_ARCHITECTURES=75. CMake 3.23 and newer otherwise defaults to all-major, so configuration does not need to query a local GPU.
Hosted CI compiles both CUDA pipelines with CUDA 12.3 but does not claim runtime validation. Compare CUDA and CPU output on real hardware before a release; see Test plan.
On a system with both NVIDIA and Intel GPUs, keeping the Intel GPU for the desktop avoids contention with the depth pipeline.
Requires Ivy Bridge or newer.
If autodetection picks the wrong render node, select one explicitly with LIBFREENECT2_VAAPI_DEVICE=/dev/dri/renderD128.
Requires OpenNI2 2.2.0.33.
To let a CMake-based third-party application find the installation:
Without this, the device is only accessible as root.
Then unplug and replug the Kinect. The rule sets MODE="0666" on vendor 045e, products 02c4, 02d8, and 02d9. To confirm it applied, check the node mode rather than running the viewer under sudo — see Troubleshooting.
Up to 5 devices have been reported working on a high-end PC using multiple separate PCI Express USB3 expansion cards with NEC controller chips.
See Recording, replay, and multiple Kinects for opening and pairing several devices in software, and USB bandwidth and transfer tuning for why the one-per-controller rule exists.
Set LIBFREENECT2_PIPELINE to select a pipeline, for example LIBFREENECT2_PIPELINE=opencl NiViewer2.