Build Python wrappers for libfreenect
masterBUILD_PYTHON or BUILD_PYTHON3 CMake flags during the configuration step.repository·master·Indexed 25 days ago
https://github.com/openkinect/libfreenectA userspace driver for the original Microsoft Kinect supporting RGB/Depth images, motors, accelerometers, LEDs, and audio on Linux, OSX, and Windows. Includes the OpenNI2-FreenectDriver for bridging Kinect hardware to OpenNI2, Python wrappers, and Fakenect for session recording and playback.
BUILD_PYTHON or BUILD_PYTHON3 CMake flags during the configuration step.To resolve C99 standard incompatibilities when compiling libfreenect with Visual Studio, force the project to compile all .c files as C++ code.
Steps:
Properties >> C/C++ >> Advanced.Compile As to Compile as C++ Code (/TP).Note for MSVC versions prior to 2010:
If the build still insists on using the C compiler, toggle the setting: set Compile As to Default, click Apply, then set it back to Compile as C++ Code (/TP), click Apply, and click OK.
Project >> Properties >> C/C++ >> Advanced >> Compile As: Compile as C++ Code (/TP)You can generate distribution packages using cpack by enabling the respective flags in CMake.
cmake .. -DBUILD_CPACK_DEB=ON -DBUILD_CPACK_RPM=ON -DBUILD_CPACK_TGZ=ON
cpackYou can install libfreenect on macOS using Homebrew or MacPorts.
Homebrew Install the stable version or the latest development version (HEAD).
MacPorts Install the necessary dependencies before proceeding with a manual build.
Follow these steps to clone and build the project using CMake. You can use CMake options to control specific build targets, such as Python wrappers or specific build types (debug vs optimized).
git clone https://github.com/OpenKinect/libfreenect
cd libfreenect
mkdir build
cd build
cmake -L .. # -L lists all project options
make
# Alternative if 'make' is unavailable:
# cmake --build .cp.To build libfreenect on Ubuntu, Debian, or Mint, install the required build tools and dependencies. If you intend to run the provided examples, you must also install the OpenGL/GLUT development packages.
Note: Remember to install the udev rules for your system to allow access to the Kinect device.
To ensure stability and performance when using libfreenect on Windows, follow these guidelines:
Sleep(1) immediately after your swap-buffers call (e.g., SwapBuffers(), glutSwapBuffers(), Present()) to reduce CPU usage.freenect_process_events().Stream operations include:
freenect_start_video()freenect_start_depth()freenect_stop_video()freenect_stop_depth()For Windows, use Zadig to install the libusbK driver for your Kinect device.
When building with CMake, you must manually provide the paths to your libusb include and library directories so CMake can locate them.
cmake .. -DLIBUSB_1_INCLUDE_DIR="C:\path\to\libusb\include" -DLIBUSB_1_LIBRARY="C:\path\to\libusb\libusb.lib"The OpenNI2-FreenectDriver allows OpenNI2 to use Kinect hardware on Linux and OSX by bridging it to libfreenect.
Follow these steps to install:
mkdir build
cd build
cmake .. -DBUILD_OPENNI2_DRIVER=ON
makelibFreenectDriver.so or libFreenectDriver.dylib) to your OpenNI2 driver repository directory. You must update the Repository path variable in the command below to match your specific project layout.Note: The driver is built with a static libfreenect, so you do not need to include libfreenect separately when deploying. However, the target system must have libusb and all other dependencies listed in ldd libFreenectDriver.so installed.
Repository="/example/path/to/Samples/Bin/OpenNI2/Drivers/"
cp -L lib/OpenNI2-FreenectDriver/libFreenectDriver.{so,dylib} ${Repository}The Windows port of libfreenect uses a libusb-1.0 emulation layer (libusbemu) that relies on libusb-win32 to communicate with the Kinect. You must install libusb-win32 to use libfreenect on Windows.
Installation:
Download the latest snapshots of libusb-win32 from the official SourceForge repository:
http://sourceforge.net/projects/libusb-win32/files/libusb-win32-snapshots
Use the CMAKE_BUILD_TYPE flag to specify the build configuration.
debug: Includes debug symbols.RelWithDebInfo: Optimized build with debug symbols.