I use OpenNI to read from a Primesense RD1.09 depth camera. Ubuntu has OpenNI library packages in its archive, but this is the older OpenNI 1.x. I find its API and device support lacking and so prefer to use OpenNI2. Also, there is no need to build the newer OpenNI2 from source since pre-built packages are available.
Installing and using OpenNI2 with Primesense is easy:
- Download: The pre-built SDK file for your Linux can be downloaded from the OpenNI homepage. It is available for x86, x64 and ARM. I downloaded the x64 SDK file and unzipped it.
OpenNI directory: Your OpenNI code and programs will look for header and library files from this unzipped directory. So, move it to a suitable location. I like to keep it in
Install: Run the installer from the unzipped directory:
$ sudo ./install.sh
All this does is to place the UDEV rules for the Primesense camera in
/etc/udev/rules.d. Your camera is now ready to be used!
- Camera detection: Plug in your depth camera to a USB port on your computer. Check if the camera is detected using
lsusbcommand. My camera is listed as
ASUSin this listing when it is detected.
Simple viewer: Run the simple viewer provided in OpenNI. You should be able to view depth and color (RGB) images now:
$ cd Tools $ ./NiViewer
Device error: If
NiViewerfailed with a no devices found error, then a solution I discovered is described here.
Color image error: If
NiVieweronly shows depth image, but no color image: this sometimes happens. Unplug and plug in the camera and try again.
Header and libraries: You will find a
OpenNIDevEnvironmentfile containing the paths for two environment variables:
OPENNI2_REDIST. Use these include and library paths when you build your own C++ code that uses OpenNI. To link with OpenNI libraries add the
Sample C++ project: If you need help starting off, I have a CMake project with code for reading from Primesense camera here.
Tried with: OpenNI 126.96.36.199, Primesense RD1.09 and Ubuntu 14.04