Problems with OpenNI 2.2 + osx

Hi, I’m trying to make OpenNi working with Openframeworks under osx.
I have already made both OpenNi and NiTE working with xcode without problems (without Openframeworks).

When i try to open a device in an Openframeworks project with the usual call:

Device device;
status = device.open(ANY_DEVICE);

I have always an error returned

ERROR: #1, 	DeviceOpen using default: no devices found

If I make the same call in an xcode project with identical setup (includes, build phases, etc.) it normally open the kinect device without any error.
I think somehow I have problems with the drivers when using Openframeworks. To include them, as other dylib i added a copy build phase:

Then i copied the OpenNi folder with the Drivers subfolder in the bin folder where the app looks for it at runtime.
If I check inside the package generated during the build all files and drivers are copied under Contents/MacOs/
I’m quite lost with this, any help would be really appreciated.
Gabriele

So you have got OpenNI2 to work with the Kinect under the Mac? I know (at first at least) the Kinect was only supported under Windows. If you can post your project somewhere I could give it a try.

Yes, I’m using last unstable version 2.2.x and it works like charms!

I made two repository:
In the first one you have the xcode project fully working and configured with OpenNi + Nite.
It should be self contained, just press play and see your skeleton detected with an amazing speed!
Since the release is unstable if you get errors or the project doesn’t start just stop it and run it again.
When it starts then is stable.

Here you have the repo:

https://github.com/Wedontplay/OpenNi---NiTE-Skeleton-Xcode5

In the second one you have the Openframeworks project configured with OpenNi, when you start it will log on the console:

----------------- NiTE + Ofx User Tracker -------------------
OpenNI Version is 2.2.0.33 
Initializing OpenNI ...
Completed.

---------------------- Open Device --------------------------
Opening any device ...
ERROR: #1, 	DeviceOpen using default: no devices found

It seems it can’t access the kinect despite it links correctly the drivers at runtime.
I’m thinking if maybe is a problem related to the fact that ofxKinect is now included in the framework and it use libfreenect.

Here you have the repo:

https://github.com/Wedontplay/OpenNi-Openframeworks-Xcode5

Additional Info:
Openframeworks version is 0.8.0
Osx version is 10.9.1
Xcode version is 5.0.2

Hi @Wedontplay,

Did you go further into this issue?

I´m trying to upgrade the openNI libraries to 2.2.0.33beta on @satoruhiga ofxNI2 . I managed to relink dlybs and compile but I found the same problem with Kinect not being found. With the openNI version that comes with the addon (2.1 or 2.0 I don’t know) it works fine.

Best,
P.

Following @satoruhiga advice I builded FreenectDriver an now the xbox kinect is found using openNI 2.2.0.33beta libraries and libfreenect v0.4.2. I´m on OSX 10.9. Wonder if this works on other cameras/system versions.

Edit:
Grr, nevermind… something with a usb plug and a socket…

But great work @Wedontplay, really helpful a complete empty project! I have been trying to get openni2 working in xcode, but kept running into dylib loading issues…

The non OF version works, it shows a depth image nicely. I would like to get the OF version working though, this one recognises the device, but the screen stays blank.
Edit2: This is the expected behavior! The code only opens the device and closes it again!

Hi @Wedontplay, I tried playing around with your first example, and although I can get the sketch to run I get ‘ERROR 1’ any idea what is causing this?