Difference between revisions of "Using Kinect with MITK-ToF"
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | Currently the Kinect for Xbox 360 is directly supported for use in | + | Currently the Kinect for Xbox 360 is directly supported for use in MITK-ToF. The following sections describe its integration in detail. MITK-ToF uses OpenNI to access the Kinect data. Since the OpenNI project was shut down, there is no official open source project. An alternative would be to use the Microsoft SDK, but this was not done yet. |
− | ''Info: The OpenNI drivers are | + | ''Info: The OpenNI drivers are meant to be working with the original Kinect for Xbox, not the newer Kinect for Windows. If you want to use your Windows device, you will have to use the official Microsoft Kinect SDK. To get this running, you have to use the OpenNI bridge to use the KinectSDK in OpenNI. More info about bridging can be obtained here: ''http://code.google.com/p/kinect-mssdk-openni-bridge/''. Bridging has not been tested yet by the MITK-ToF developer team. |
− | |||
− | '' | ||
== Linux == | == Linux == | ||
− | + | Get the Kinect-Software running on Linux (Ubuntu 14.04): | |
− | # Install the | + | # Install the required packages: |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 16: | Line 14: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | # OpenNI | + | # Clone OpenNI and checkout the a commit which works: |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | git clone https://github.com/ | + | git clone https://github.com/OpenNI/OpenNI.git |
cd OpenNI/ | cd OpenNI/ | ||
− | git checkout | + | git checkout 7409554df0761bca0213c900189885ff3c4ac852 |
</syntaxhighlight> | </syntaxhighlight> | ||
+ | # After this you should be on the commit "Fixed missing files from the Linux common directory." by Ziv Hendel. | ||
# Build and install OpenNI: | # Build and install OpenNI: | ||
Line 34: | Line 33: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | # Clone Avin2 | + | # Clone Avin2 Kinect sensor (the actual driver): |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 40: | Line 39: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | # Build and install | + | # Build and install the driver: |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 47: | Line 46: | ||
./RedistMaker | ./RedistMaker | ||
cd ../Redist/Sensor-Bin-Linux-x64-v5.1.0.25/ | cd ../Redist/Sensor-Bin-Linux-x64-v5.1.0.25/ | ||
− | chmod +x install.sh sudo ./install.sh | + | chmod +x install.sh |
+ | sudo ./install.sh | ||
</syntaxhighlight> | </syntaxhighlight> | ||
# ''Set the respective CMake variables in your MITK-build: <br /> <br />'' | # ''Set the respective CMake variables in your MITK-build: <br /> <br />'' | ||
− | |||
#* Activate MITK_USE_KINECT | #* Activate MITK_USE_KINECT | ||
#* MITK_KINECT_INCLUDE_DIR = /usr/local/ni | #* MITK_KINECT_INCLUDE_DIR = /usr/local/ni | ||
#* MITK_KINECT_LIB = /usr/lib/libOpenNI.so <br /> <br /> '' '' | #* MITK_KINECT_LIB = /usr/lib/libOpenNI.so <br /> <br /> '' '' | ||
− | # ''(Optional) | + | |
+ | # ''(Optional) Sometimes the USB Mod has to be deactivated: <br />'' | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo modprobe -r gspca_kinect | sudo modprobe -r gspca_kinect | ||
− | sudo sh -c 'echo " | + | sudo sh -c 'echo "blackli |
+ | Clone OpenNI and checkout the a commit which works: | ||
+ | st gspca_kinect" > /etc/modprobe.d/blacklist- | ||
kinect.conf' | kinect.conf' | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | # For c++11 you have to adapt the following file: | ||
+ | |||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo nano /usr/include/ni/XnPlatform.h | ||
+ | |||
+ | Change line 65 to (only add __): | ||
+ | #elif (__linux__ && (__i386__ || __x86_64__)) | ||
+ | |||
+ | Change line 67 tp: | ||
+ | #elif (__linux__ && __arm__) | ||
+ | </syntaxhighlight> | ||
== Windows == | == Windows == | ||
''Installing the necessary software on Windows: '' | ''Installing the necessary software on Windows: '' | ||
− | # ''Download the OpenNI Binaries | + | # ''Download the OpenNI Binaries. They are still available at: ''http://fivedots.coe.psu.ac.th/~ad/kinect/installation.html'' and install them in <OpenNIInstallationDir> (e.g. C:\Programs\OpenNI) <br /> <br /> '' |
# ''Dowload and install the Kinect drivers (SensorKinect) from https://github.com/avin2/SensorKinect (x64:''' '''https://github.com/downloads/avin2/SensorKinect/SensorKinect093-Bin-Win64-v5.1.2.1.msi ) <br /> <br />'' | # ''Dowload and install the Kinect drivers (SensorKinect) from https://github.com/avin2/SensorKinect (x64:''' '''https://github.com/downloads/avin2/SensorKinect/SensorKinect093-Bin-Win64-v5.1.2.1.msi ) <br /> <br />'' | ||
# ''Set the CMake variables in MITK-build: <br /> '' | # ''Set the CMake variables in MITK-build: <br /> '' | ||
− | |||
#* ''Activate MITK_USE_KINECT '' | #* ''Activate MITK_USE_KINECT '' | ||
#* ''MITK_KINECT_INCLUDE_DIR = <OpenNIInstallationDir>\Include '' | #* ''MITK_KINECT_INCLUDE_DIR = <OpenNIInstallationDir>\Include '' | ||
#* ''MITK_KINECT_LIB = <OpenNIInstallationDir>\Lib64 '' | #* ''MITK_KINECT_LIB = <OpenNIInstallationDir>\Lib64 '' | ||
+ | |||
+ | #'''Important Note''': Visual Studio 2012 is now required for MITK and is officially not supported by OpenNI, but it turns out that at least everything related to MITK-ToF works fine. So you can just comment out the respective error message in XnPlattform.h: | ||
+ | //#error Xiron Platform Abstraction Layer - Win32 - Microsoft Visual Studio versions above 2010 (10.0) are not supported! |
Latest revision as of 12:07, 18 May 2018
Currently the Kinect for Xbox 360 is directly supported for use in MITK-ToF. The following sections describe its integration in detail. MITK-ToF uses OpenNI to access the Kinect data. Since the OpenNI project was shut down, there is no official open source project. An alternative would be to use the Microsoft SDK, but this was not done yet.
Info: The OpenNI drivers are meant to be working with the original Kinect for Xbox, not the newer Kinect for Windows. If you want to use your Windows device, you will have to use the official Microsoft Kinect SDK. To get this running, you have to use the OpenNI bridge to use the KinectSDK in OpenNI. More info about bridging can be obtained here: http://code.google.com/p/kinect-mssdk-openni-bridge/. Bridging has not been tested yet by the MITK-ToF developer team.
Linux
Get the Kinect-Software running on Linux (Ubuntu 14.04):
- Install the required packages:
<syntaxhighlight lang="bash"> sudo apt-get install freeglut3-dev libusb-1.0-0-dev </syntaxhighlight>
- Clone OpenNI and checkout the a commit which works:
<syntaxhighlight lang="bash"> git clone https://github.com/OpenNI/OpenNI.git cd OpenNI/ git checkout 7409554df0761bca0213c900189885ff3c4ac852 </syntaxhighlight>
- After this you should be on the commit "Fixed missing files from the Linux common directory." by Ziv Hendel.
- Build and install OpenNI:
<syntaxhighlight lang="bash"> cd OpenNI/Platform/Linux/CreateRedist/ chmod +x RedistMaker ./RedistMaker cd ../Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.2.23/ sudo ./install.sh </syntaxhighlight>
- Clone Avin2 Kinect sensor (the actual driver):
<syntaxhighlight lang="bash"> git clone git://github.com/avin2/SensorKinect.git SensorKinect </syntaxhighlight>
- Build and install the driver:
<syntaxhighlight lang="bash"> cd SensorKinect/Platform/Linux/CreateRedist/ chmod +x !RedistMaker ./RedistMaker cd ../Redist/Sensor-Bin-Linux-x64-v5.1.0.25/ chmod +x install.sh sudo ./install.sh </syntaxhighlight>
- Set the respective CMake variables in your MITK-build:
- Activate MITK_USE_KINECT
- MITK_KINECT_INCLUDE_DIR = /usr/local/ni
- MITK_KINECT_LIB = /usr/lib/libOpenNI.so
- (Optional) Sometimes the USB Mod has to be deactivated:
<syntaxhighlight lang="bash"> sudo modprobe -r gspca_kinect sudo sh -c 'echo "blackli
Clone OpenNI and checkout the a commit which works:
st gspca_kinect" > /etc/modprobe.d/blacklist- kinect.conf' </syntaxhighlight>
- For c++11 you have to adapt the following file:
<syntaxhighlight lang="bash"> sudo nano /usr/include/ni/XnPlatform.h
Change line 65 to (only add __):
- elif (__linux__ && (__i386__ || __x86_64__))
Change line 67 tp:
- elif (__linux__ && __arm__)
</syntaxhighlight>
Windows
Installing the necessary software on Windows:
- Download the OpenNI Binaries. They are still available at: http://fivedots.coe.psu.ac.th/~ad/kinect/installation.html and install them in <OpenNIInstallationDir> (e.g. C:\Programs\OpenNI)
- Dowload and install the Kinect drivers (SensorKinect) from https://github.com/avin2/SensorKinect (x64: https://github.com/downloads/avin2/SensorKinect/SensorKinect093-Bin-Win64-v5.1.2.1.msi )
- Set the CMake variables in MITK-build:
- Activate MITK_USE_KINECT
- MITK_KINECT_INCLUDE_DIR = <OpenNIInstallationDir>\Include
- MITK_KINECT_LIB = <OpenNIInstallationDir>\Lib64
- Important Note: Visual Studio 2012 is now required for MITK and is officially not supported by OpenNI, but it turns out that at least everything related to MITK-ToF works fine. So you can just comment out the respective error message in XnPlattform.h:
//#error Xiron Platform Abstraction Layer - Win32 - Microsoft Visual Studio versions above 2010 (10.0) are not supported!