Trouble creating depth stream using OpenNI


After following the quick start guide I am able to stream and visualize data using NiViewer however I have problems retrieving data using the OpenNi2 library. The problem occurs when I try to create a data stream, see the minimal example below:

C++ code:

#include “stdafx.h”

#include “iostream”

#include “OpenNI.h”

using namespace std;

using namespace openni;

int main()


   Status rc = OpenNI::initialize();
   if (rc != STATUS_OK)
         printf("Initialize failed\n%s\n", OpenNI::getExtendedError());

   Device device;
   rc =;
   if (rc != STATUS_OK)
         printf("Couldn't open device\n%s\n", OpenNI::getExtendedError());
   VideoStream depth;

   if (device.getSensorInfo(SENSOR_DEPTH) != NULL)
         rc = depth.create(device, SENSOR_DEPTH);
         if (rc != STATUS_OK)
               printf("Couldn't create depth stream \n%s\n", OpenNI::getExtendedError());
   return 0;


Couldn’t create depth stream
XnOniDevice: Can’t initialize stream of type 3: Failed to set USB interface!
Stream: Couldn’t create using source 3
Context: Couldn’t create stream from device:c9beaad0, source 3

This output is often assigned to not adapting PS1080.ini correctly, however I did change “;UsbInterface=2” to “UsbInterface=0” and saved the file.
Does anyone have an idea what could have gone wrong? Again, when using NiViewer it works fine.
Could the USB interface be handled differently due to the fact that I am using Windows on a virtual machine with OSX underneath?

-Macbook Pro (gen 3, i7)
-Windows 10 pro via Parallels 11.2.1 on OSX Sierra
(In Parallels the sensor is assigned to connect directly to Windows)
-Visual studio 2015
-Sensor model: ST01



For the samples, e.g., SimpleRead, the “UsbInterface=0” change to PS1080.ini should be made in the %OPENNI2_REDIST64% directory. This is necessary because the sample projects’ Post-Build Event will copy from that location to an OpenNi2\Drivers folder under each project’s $(OutDir).

For your example, ensure that the modified PS1080.ini exists in an OpenNi2\Drivers folder under your app’s .exe folder…



Thanks, that worked!