今天无意间发现,openkinect一直在更新,现在说已经支持Kinect2.0了,并且根据他们的说法,支持跨平台。我不知道在飞win平台,是否可以用骨骼数据等?分享在这里,希望有需求的人尝试看看,无论失败成功都留个言吧!
源地址:https://github.com/OpenKinect/libfreenect2
以下摘录readme文件
libfreenect2
Description
Driver for Kinect for Windows v2 (K4W2) devices (release and developer preview).
Note: libfreenect2 does not do anything for either Kinect for Windows v1 or Kinect for Xbox 360 sensors. Use libfreenect1 for those sensors.
This driver supports:
- RGB image transfer
- IR and depth image transfer
- registration of RGB and depth images
Missing features:
- audio transfer
- firmware updates
Watch the OpenKinect wiki at www.openkinect.org and the mailing list athttps://groups.google.com/forum/#!forum/openkinect for the latest developments and more information about the K4W2 USB protocol.
FAQ
Can I use the Kinect v2 without an USB3 port?
No. It’s a pure USB3 device due to the high bandwidth requirements.
Protonect complains about “no device connected” or “failure opening device”.
Either your device is connected to an USB2-only port (see above), or you don’t have permissions to access the device. On Linux, try running Protonect as root (e.g. using sudo
). If that fixes things, place rules/90-kinect2.rules
into/etc/udev/rules.d/
and re-plug the device.
On Linux, also check dmesg
. If there are warnings like usb 4-1.1: Not enough bandwidth for new device state.
it means the hardware does not have the capacity for USB3 even if it claims so, or its capacity is not well supported.
On Mac OS X, open “System Information” from Spotlight, go to the USB section, and verify “Xbox NUI Sensor” is under “USB 3.0 SuperSpeed Bus” not “High-Speed Bus”. If this is not the case, try unplugging the Kinect from power source with the USB cable connected, and plug the power again, then verify.
I’m getting lots of USB transfer errors, and/or only blank windows.
USB3 as a whole is a flaky thing. If you’re running Linux, try upgrading to a recent kernel (>= 3.16) first. If that doesn’t work, try a different USB3 controller. The following ones are known to work on a 3.16 kernel:
- Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI
- Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI
- NEC Corporation uPD720200 USB 3.0 Host Controller
Probably not working:
- ASMedia Technology Inc. Device 1142
- ASMedia Technology Inc. ASM1042
Messages in dmesg
like this means bugs in the USB driver. Updating kernel might help.
1 2 3 |
[ 509.238571] xhci_hcd 0000:03:00.0: xHCI host not responding to stop endpoint command. [ 509.238580] xhci_hcd 0000:03:00.0: Assuming host is dying, halting host. |
Finally, it’s also possible that your executable is not actually using the patched libusb from the depends/
folder which is required at the moment. Check this using ldd ./Protonect | grep libusb
(shows libusb-1.0
under depends/
), and adjust your LD_LIBRARY_PATH
if necessary.
I’m seeing the color camera stream, but no depth/IR (black windows).
The depth packet processor runs on OpenGL by default. You can try alternatives, such as OpenCL (by running Protonect cl
) or CPU (Protonect cpu
). At least the CPU DPP should always produce some output, although slow.
For OpenCL on Intel/Linux, you can also try to set /sys/module/i915/parameters/enable_cmd_parser
to 0.
Can I use multiple Kinect v2 devices on one machine?
Yes – in fact, this has been reported to work for up to 5 devices on a high-end PC using multiple separate PCI Express USB3 expansion cards (with NEC controller chip).
If you’re using Linux, you may have to increase USBFS memory buffers by appending usbcore.usbfs_memory_mb=64
to your kernel commandline. Depending on the number of Kinects, you may need to use an even larger buffer size.
If you’re using an expansion card, make sure it’s not plugged into an PCI-E x1 slot. A single lane doesn’t have enough bandwidth. x8 or x16 slots usually work.
Maintainers:
- Joshua Blake joshblake@gmail.com
- Florian Echtler
- Christian Kerl
Installation
This project uses the libusbx drivers and API. Setting things up varies by platform.
Windows / Visual Studio
libusbK driver
If you have the Kinect for Windows v2 SDK, install it first. You don’t need to uninstall the SDK or the driver before doing this procedure.
Install the libusbK backend driver for libusbx:
- Download Zadig from http://zadig.akeo.ie/.
- Run Zadig and in options, check List All Devices and uncheck Ignore Hubs or Composite Parents
- Select the Xbox NUI Sensor (composite parent) from the drop-down box. (Ignore the Interface 0 and Interface 2 varieties.) The current driver will list usbccgp. USB ID is VID 045E, PID 02C4.
- Select libusbK (v3.0.6.0) from the replacement driver list.
- Click the Replace Driver button. Click yes on the warning about replacing a system driver. (This is because it is a composite parent.)
- Done.
To uninstall the libusbK driver (and get back the official SDK driver, if installed):
- Open Device Manager
- Under libusbK USB Devices, right click the “Xbox NUI Sensor (Composite Parent)” device and select uninstall.
- Important: Check the “Delete the driver software for this device.” checkbox, then click OK.
If you already had the official SDK driver installed and you want to use it:
- In Device Manager, in the Action menu, click “Scan for hardware changes.”
This will enumerate the Kinect sensor again and it will pick up the K4W2 SDK driver, and you should be ready to run KinectService.exe again immediately.
You can go back and forth between the SDK driver and the libusbK driver very quickly and easily with these steps.
libusb
- Build from source (recommended)
1 2 3 4 5 6 |
<span class="pl-c1">cd</span> depends/ git clone https://github.com/libusb/libusb.git <span class="pl-c1">cd</span> libusb git remote add joshblake https://github.com/JoshBlake/libusbx.git git fetch joshblake git merge joshblake/winiso <span class="pl-c"># patches for libusbK backend</span> |
Open libusb/msvc/libusb_2013.sln
with Visual Studio 2013 (or older version, accordingly), set configurations to “Release x64”, and build “libusb-1.0 (dll)”. You can clone the libusb repo to somewhere else, but you will need to set environment variable LibUSB_ROOT
to that path. Building with “Win32” is not recommended as it results in lower performance.
- Pre-built binary
Joshua Blake provided a Debug version binary: https://www.dropbox.com/s/madoye1ayaoajet/libusbx-winiso.zip. Install it asdepends/libusbx
. This version was built in 2013.
TurboJPEG
- Download from http://sourceforge.net/projects/libjpeg-turbo/files
- Extract it to the default path (
c:\libjpeg-turbo64
), or asdepends/libjpeg-turbo64
, or anywhere as long as the environment variableTurboJPEG_ROOT
is set to installed path.
GLFW
- Download 64-bit Windows binaries from http://www.glfw.org/download.html
- Extract it as
depends/glfw
(renameglfw-3.x.x.bin.WIN64
to glfw), or anywhere as long as the environment variableGLFW_ROOT
is set to the installed path.
OpenCL
- Intel GPU: Download
intel_sdk_for_ocl_applications_2014_x64_setup.msi
fromhttp://www.softpedia.com/get/Programming/SDK-DDK/Intel-SDK-for-OpenCL-Applications.shtml (SDK official download is replaced by $$$ and no longer available) and install it. Then verifyINTELOCLSDKROOT
is set as an environment variable.
Build
1 2 3 4 |
mkdir build && cd build cmake .. -G "Visual Studio 12 2013 Win64" -DCMAKE_INSTALL_PREFIX=. cmake --build . --config Release --target install |
Then you can run the program with .\bin\Protonect.exe
. If DLLs are missing, you can copy them to the bin
folder.
Mac OSX
Use your favorite package managers (brew, ports, etc.)
cd
into a directory where you want to keep libfreenect2 stuff in- Make sure these build tools are available: wget, git, cmake, pkg-config, automake, autoconf, libtool. Xcode may provide some of them. Install the rest via package managers.
- Install dependencies: TurboJPEG, GLFW.
123456brew updatebrew tap homebrew/sciencebrew install jpeg-turbobrew tap homebrew/versionsbrew install glfw3
Do not install libusb via package managers for libfreenect2. libfreenect2 includes an unreleased local version of libusb with USB3 specific patches. libfreenect2’s libusb should still work fine in presence of a global version libusb.It is not recommended to build TurboJPEG from source, which produces corrupted results on Mac OSX according to reports. Install TurboJPEG binary only from package managers.
- Download the libfreenect2 repository
12git clone git@github.com:OpenKinect/libfreenect2.git
- Install a bunch of dependencies
123cd ./libfreenect2sh ./depends/install_mac.sh
- Build the actual protonect executable
12345mkdir build && cd buildcmake ..makemake install
- Run the program
12./bin/Protonect
Debian/Ubuntu 14.04 (perhaps earlier)
- Install libfreenect2
12git clone https://github.com/OpenKinect/libfreenect2.git
- Install a bunch of dependencies
1234567sudo apt-get install build-essential libturbojpeg libjpeg-turbo8-dev libtool autoconf libudev-dev cmake mesa-common-dev freeglut3-dev libxrandr-dev doxygen libxi-dev automake<span class="pl-c"># sudo apt-get install libturbojpeg0-dev (Debian)</span><span class="pl-c1">cd</span> libfreenect2/dependssh install_ubuntu.shsudo dpkg -i libglfw3<span class="pl-k">*</span>_3.0.4-1_<span class="pl-k">*</span>.deb <span class="pl-c"># Ubuntu 14.04 only</span><span class="pl-c"># sudo apt-get install libglfw3-dev (Debian/Ubuntu 14.10+:)</span>
- OpenCL dependency
- AMD GPU: Install the latest version of the AMD Catalyst drivers from https://support.amd.com and
apt-get install opencl-headers
. - Nvidia GPU: Install the latest version of the Nvidia drivers, for example nvidia-346 from
ppa:xorg-edgers
andapt-get install opencl-headers
. - Intel GPU (kernel 3.16+ recommended): Install beignet-dev 1.0+,
apt-get install beignet-dev
. If not available, use this ppasudo apt-add-repository ppa:pmjdebruijn/beignet-testing
.
- AMD GPU: Install the latest version of the AMD Catalyst drivers from https://support.amd.com and
- Build the actual protonect executable
12345mkdir build && cd buildcmake ..makesudo make install
- Run the program
12./bin/Protonect
Other operating systems
I’m not sure, but look for libusbx installation instructions for your OS. Figure out how to attach the driver to the Xbox NUI Sensor composite parent device, VID 045E PID 02C4, then contribute your procedure.
Required notification
The K4W2 hardware is currently pre-release. Per the K4W2 developer program agreement, all public demonstrations and code should display this notice:
1 |
"This is preliminary software and/or hardware and APIs are preliminary and subject to change." |