|
libfreenect2 0.4
Open source driver for the Kinect for Windows v2 (K4W2) sensor
|
This is the reference install path for macOS, including Apple Silicon. For a condensed version see the README.
Apple Silicon (M1 and later) is supported with native arm64 builds and the metal depth pipeline. Intel Macs are supported through the opengl, opencl, and cpu pipelines.
Install the tools first. Xcode may already provide some of them.
Cloning OpenKinect/libfreenect2 instead gets you upstream, which has no Metal pipeline and none of the 0.4 APIs described in the guides.
Required:
Optional:
glfw3 is only needed for the example viewer; a library-only build can use -DBUILD_EXAMPLES=OFF.
The old brewsci/science bottle is no longer downloadable (the hosted archive returns 404), so build OpenNI2 from source:
Not available on macOS. ENABLE_CUDA has no effect here.
The default install prefix is CMake's platform default; pass -DCMAKE_INSTALL_PREFIX=$HOME/freenect2 to install somewhere writable without sudo.
Run the test program:
ENABLE_METAL defaults to ON on Apple platforms. When no pipeline is requested, createDefaultPacketPipeline() probes Metal first and falls through to the next available backend, ending at cpu. OpenGL is deprecated by Apple; prefer metal.
The VideoToolbox RGB decoder crashes on M1 and later, so ENABLE_VIDEOTOOLBOX defaults to OFF there and RGB decoding uses TurboJPEG. On Intel Macs it defaults to ON. See ENABLE_VIDEOTOOLBOX in CMakeLists.txt.
The most common Apple Silicon failure is an architecture mismatch between the build and the installed libraries:
or a wall of missing libusb/GLFW symbols at link time. CMake detects this at configure time and stops with instructions. To avoid it:
macOS needs no udev-style rules. If the device is not enumerated, unplug it, wait a few seconds, and replug it into a USB 3.0 port directly on the machine rather than through a hub.
Set LIBFREENECT2_PIPELINE to select a pipeline, for example LIBFREENECT2_PIPELINE=metal NiViewer.