In my previous blog post I described how to connect a OPT8241 depth camera from Texas Instruments to a Raspberry Pi 3 and run Point Cloud Library and Voxel SDK. In this blog post I will describe how to connect a Kinect v1 to a Raspberry Pi 3.
Preliminaries
If your RPi-3 is brand new and does not have Ubuntu Mate running on it, follow this blog post to get Ubuntu Mate 16.04 running on it. Once you have a RPi-3 running Ubuntu Mate 16.04, follow instruction in the Setup Prerequisites and Build Point Cloud Library sections.
More Prerequisites
To run Kinect with PCL we need to install and build OpenNI and SensorKinect, which requires some additional prerequisites:
sudo apt-get update sudo apt-get install doxygen graphviz g++-multilib
Both doxygen
and g++-multilib
are needed to build OpenNI and SensorKinect.
Install OpenNI
The install OpenNI, do the following:
cd mkdir kinect cd kinect git clone https://github.com/OpenNI/OpenNI.git cd OpenNI git checkout unstable
and edit the file:
gedit ./Platform/Linux/Build/Common/Platform.Arm
and delete ‘-mfloat-abi=softfp
‘.
Now build and install OpenNI:
cd ~/kinect/OpenNI/Platform/Linux/CreateRedist ./RedistMaker.Arm
Once build completes install it by:
cd ~/kinect/OpenNI/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-Arm-V1.5.8.5 sudo ./install.sh
Install SensorKinect
The install SensorKinect, do the following:
cd ~/kinect git clone https://github.com/avin2/SensorKinect.git cd SensorKinect git checkout unstable
and edit the file:
gedit ./Platform/Linux/Build/Common/Platform.Arm
and delete ‘-mfloat-abi=softfp
‘.
Now build and install SensorKinect:
cd ~/kinect/SensorKinect/Platform/Linux/CreateRedist ./RedistMaker
Once build completes install it by:
cd ~/kinect/SensorKinect/Platform/Linux/Redist/Sensor-Bin-Dev-Linux-Arm-v5.1.2.1/ sudo ./install.sh
Connect Kinect
At this point, Kinect is ready. You can test it by running this:
cd ~/kinect/OpenNI/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-Arm-v1.5.8.5 ./Sample-NiSimpleRead
You should get something like this:
Frame 98 Middle point is: 5719. FPS: 26.939665 Frame 99 Middle point is: 5719. FPS: 26.937723 Frame 100 Middle point is: 5626. FPS: 27.259674 Frame 101 Middle point is: 5626. FPS: 27.284256 Frame 102 Middle point is: 5719. FPS: 26.628609 Frame 103 Middle point is: 5719. FPS: 26.604128 Frame 104 Middle point is: 5626. FPS: 26.590570 Frame 105 Middle point is: 5719. FPS: 26.623127 Frame 106 Middle point is: 5719. FPS: 26.587439 Frame 107 Middle point is: 5719. FPS: 26.593811 Frame 108 Middle point is: 5719. FPS: 26.917368 ...
If you get some error like
Reading config from: '../../Config/SamplesConfig.xml' Warning: USB events thread - failed to set priority. This might cause loss of data... Open failed: USB interface is not supported!
make the following edit:
cd ~/kinect/SensorKinect/Platform/Linux/Redist/Sensor-Bin-Linux-Arm-v5.1.2.1/Config/ sudo gedit GlobalDefaultsKinect.ini
and modify `;UsbInterface=2
` into `UsbInterface=1
`
One can get a visual using guvcview
, but first one must do a few things:
sudo modprobe videodev sudo modprobe gspca_main sudo modprobe gspca_kinect depth_mode=1
After the above /dev/video0
should appear in system. Now you can launch guvcview
and get the below images. The first is from the depth camera and appears to show raw amplitude map of the Kinect structured light pattern. The second is from color camera (YUYV).

Figure 1 – Structured light camera image.

Figure 2 – RGB camera image.
when i try to run the example it just opens the terminal window and closes it in a snap
Did you launch it from a pre-opened terminal?
Yuehchuan and Victor, editing the UsbInterface=1 value in /usr/etc/primesense/GlobalDefaultsKinect.ini worked for me.
Hey where i get the kinect depth data? and where is the programming interface?
Sorry for the bad english
Hi, would this also work with the Asus XTion? It’s the same hardware as the first Kinect.
Yes, it should. But Asus XTion is discontinued and replaced with XTion-2.
https://www.asus.com/3D-Sensor/Xtion-2/
Thanks, effectively, I do have the Xtion 2 🙂
Trying to follow your instructions now, however, have the latest Raspbian Jessie installed.
Two things:
– when I want to install “g++-multilib”, I get the error “Unable to locate package, couldn’t find any package by regex “g++-multilib”
– secondly, I just read that there are prerequisites from your other article, there I learn that you’re using Ubuntu mate.
Could these two things be related?
Most certainly could, as each distribution handles the file system, package manager and libraries differently. But Jessie and Ubuntu Mate are both variants of Debian, so I think there should be g++-multilib available for Jessie.
https://packages.debian.org/jessie/g++-multilib
hm, strange. “apt-cache search multilib” doesn’t deliver anything on the latest raspbian jessie pixel…
Try “apt-cache search g++-multilib”
Sorry, just delivers nothing. when I do “apt-cache search g++-multilib”, i tried to install g++ without multilib but OS says that I have the most current version already. Seems like g++ is a “better” version of gcc, but I have no clue where to tell the make file to use gcc or g++.
g++ is C++ compiler, while g++-multilib is standard library for different architecture for g++. g++ looks at your file name extension, *.cpp, *.cxx are C++ files.
Hi I already follow your post now stock in the step
Reading config from: ‘../../Config/SamplesConfig.xml’
Warning: USB events thread – failed to set priority. This might cause loss of data…
Open failed: USB interface is not supported!
already modify `;UsbInterface=2` into `UsbInterface=1`
and some issue I want to mention
for install Sensorkinect there is an virtual functuin issue need to solve with this commit
https://github.com/avin2/SensorKinect/pull/5/commits/94d6ed38751571051b3acbdad4ea874f41deb375
And when testing the executable Sample-NiSimpleRead ; the path should be under
/home/ubuntu/kinect/OpenNI/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-Arm-v1.5.8.5/Samples/Bin/Arm-Debug/
In your Post is
cd ~/kinect/OpenNI/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-Arm-v1.5.8.5 not complete
that’s it.
If I solve the issue for usb, I will update.
Mine invironment is RPi3 with ubuntuMATE 16.04 and ever install ROS Kinetic
Hello, I’m trying to use libfreenect instead off SensorKinect. I already install libfreenect successfully, OpenNI following your instruction but I can’t get them to work together. Do you have any suggestion ?
My environment is RPi3 with raspbian jessie.
Looks like you need to try update it to OpenNI2. but you likely will run into other problems. I haven’t tried it yet.
https://github.com/OpenKinect/libfreenect/issues/498
Yuehchuan, Did you find a solution for the usb issue?
I have the same problem of you.