ofxOpenNI Development

Hi,
I made some test with the latest experimental branch version , but have a couple of problems :
(System: Windows 7 , VS2010 )

When I run the UserAndCloud-Medium example I’ll get all the time some Log warnings when a user is tracked :

  
  
OF: OF_LOG_ERROR: ofPixels: format not supported, not allocating  
ofxOpenNIDevice[0]: OF_LOG_ERROR: Mask pixel type not supported: -1163005939  
  

I realized that the maskPixelFormat from a ofxOpenNIUser is never set so the property is undefined .
After adding this line to testapp::update() the warnings are gone :

  
  
openNIDevices[0].setMaskPixelFormatAllUsers(ofPixelFormat::OF_PIXELS_RGBA);  
  

The next problem is that the user tracking doesn’t work reasonable.
When a tracked user is lost I’ll get immediately this log message:

  
  
ofxOpenNIDevice[0]: OF_LOG_NOTICE: Stop tracking user1  
OF: OF_LOG_NOTICE: USER_TRACKING_STOPPEDfor user 1 from device 0  
  

(the second message is from the testApp::userEvent callback )
when i wait 10 seconds (without a user in front of the camera) I’ll get a second message :

  
ofxOpenNIDevice[0]: OF_LOG_NOTICE: Stop tracking user1  

The problem is that when a user comes back before the 10 seconds are past the usertracking doesn’t work any more and to get it back I have too wait the 10 seconds (but no user must in front of the camera). So I have no chance to leave the camera for a second and come back to be tracked again and I also block further tracking.

Is the experimantal banch so experimental that this is a know behaviour? Or are ther some settings that I have to consider?

Thanks

Hello all!
I too am having some issues running the examples. This is my first attempt at working with ofxOpenNI in OSX Lion and when using the experimental branch of today I get the following log in the console:

  
ofxOpenNIDevice[0]: OF_LOG_WARNING: Using a NASTY hack to silence SIGNAL errors on exit - read the comments at line ~1712 of ofxOpenNI.cpp  
ofxOpenNIDevice[0]: OF_LOG_NOTICE: Init context...  
ofxOpenNIDevice[0]: OF_LOG_VERBOSE: Context initilized status:OK  
ofxOpenNIDevice[0]: OF_LOG_NOTICE: openni driver version: 1.5.4.0  
ofxOpenNIDevice[0]: OF_LOG_NOTICE: Adding licence...  
ofxOpenNIDevice[0]: OF_LOG_VERBOSE: Adding licence: PrimeSense 0KOIk2JeIBYClPWVnMoRKn5cdY4= status:OK  
ofxOpenNIDevice[0]: OF_LOG_NOTICE: Init device...  
ofxOpenNIDevice[0]: OF_LOG_VERBOSE: Enumerate devicesstatus:OK  
ofxOpenNIDevice[0]: OF_LOG_NOTICE: Found1devices connected  
ofxOpenNIDevice[0]: OF_LOG_VERBOSE: Creating production tree for device 0 status:OK  
ofxOpenNIDevice[0]: OF_LOG_NOTICE: Adding generator typeXN_NODE_TYPE_DEPTH  
ofxOpenNIDevice[0]: OF_LOG_VERBOSE: Creating XN_NODE_TYPE_DEPTH generator status:OK  
ofxOpenNIDevice[0]: OF_LOG_VERBOSE: Setting Depth1 resolution: 640 x 480 at 30fps status:OK  
ofxOpenNIDevice[0]: OF_LOG_VERBOSE: Starting XN_NODE_TYPE_DEPTH generator status:OK  
ofxOpenNIDevice[0]: OF_LOG_VERBOSE: Allocating depth  
ofxOpenNIDevice[0]: OF_LOG_NOTICE: Adding generator typeXN_NODE_TYPE_IMAGE  
ofxOpenNIDevice[0]: OF_LOG_VERBOSE: Creating XN_NODE_TYPE_IMAGE generator status:OK  
ofxOpenNIDevice[0]: OF_LOG_VERBOSE: Setting Image1 resolution: 640 x 480 at 30fps status:OK  
ofxOpenNIDevice[0]: OF_LOG_VERBOSE: Starting XN_NODE_TYPE_IMAGE generator status:OK  
ofxOpenNIDevice[0]: OF_LOG_VERBOSE: Allocating image  
ofxOpenNIDevice[0]: OF_LOG_NOTICE: Starting ofxOpenNI with threading  
  

Xcode compilled the code perfectly in all instances, but it always gets stuck at OF_LOG_NOTICE: Starting ofxOpenNI with threading. I tried the stable github version a few hours ago and it worked and was able to run the old example.

Any thoughts?

Anyways, this is a remarcable improvement over the older versions of ofxOpenNI so thank you all for your hard work! I really appreciate it. =D

Hi,

have you tried the solution:

if I search and replace

Code:
view plaincopy to clipboardprint?
if(bIsThreaded) Poco::ScopedLock lock(mutex);

back to

Code:
view plaincopy to clipboardprint?
if(bIsThreaded) Poco::ScopedLock lock();

I had some problems with the threads, still have some times, but I can manage to make the code work pretty well
at the moment…
I think the new experimental version is more simple and is more stable than the older versions in some situations.

I hope you can do it.

ps: you have to set your code to compile as 32-bits and openframeworks osx 10.6.

@paulo.trigueiros
Hey that actually did work! :smiley:
Even if it is a fast fix it will allow me to get back to work meanwhile!
Thanks Paulo!

Hello again all. I’ve managed to port a bit my code from the following project to ofxOpenNI:
http://forum.openframeworks.cc/t/universal-multitouch-wall-using-microsoft-sdk,-openframeworks-and-ofxkinectnui/9908/0

As Roy suggested in that thread, I am now trying to use ofShortImage so I first allocate it and then fill it with the getDepthRawPixels(). Both are supposed to be unsigned short types. The ofShortImage was allocated as OF_IMAGE_GRAYSCALE just like is defined in ofxOpenNI ( allocateDepthRawBuffer), but… I’m getting the following, can anyone shed some light on my problem and why it might happen?
I see that the buffer is actually an array made up of the currentDepthBuffer and the backDepthBuffer but I don’t know how to just get one part of it.

Thanks in advanced. =D

–Edit 1>
Also, is it still possible to get the depth value of a pixel in a certain x and y coordinates? I can’t seem to find the equivalent in the experimental branch (Projective maybe?)

–Edit 2>
Might be a weirder bug in the drawing function for ofShortImage. Don’t know if it was resolved http://forum.openframeworks.cc/t/ofshortpixels-doesn’t-draw-pixels-correctly/9790/0

–Edit 3>
I managed to work around the problem, the values are there but the draw() doesn’t render correctly. I can confirm the values are there. I checked by turning the ofShortImage into a very posterized ofImage (16bpc to 8bpc)… very psychedelic, anyways thank you and I hope all this helps someone :smiley:

Hello yet again. I’ve been playing around with the getDepthRawPixels(). I thought the Kinect had 11bpc as resolution for depth but I’m getting different values that are very coherent with millimeters and that are larger than the 2048 max value (max value for the kinect?)
At close range just before the kinect cannot read I get 500 (which I’m guessing is mm) and I can see past 3500.
Does getDepthRawPixels() return values in mm?
Does the api convert the depth resolution into mm?

When I do manage to get something working with my port I’ll definitely post it on that thread so thank you. :smiley:

–Edit->
The older version of ofxOpenNI had setTiltAngle() for mac. Is that still around? because I cannot find it.

–Edit 2>
Here is the thread about the port I did from ofxKinectNui to ofxOpenNI, just in case anyone ever wants to send depth data into ofxOpenCv. The info about the port is in my last post.
http://forum.openframeworks.cc/t/universal-multitouch-wall-using-microsoft-sdk,-openframeworks-and-ofxkinectnui/9908/0
http://forum.openframeworks.cc/t/universal-multitouch-wall-using-microsoft-sdk,-openframeworks-and-ofxkinectnui/9908/60

@gameover

hi matt

I was wondering if you have any plans to build the openNi libs as portable dylibs using the latest versions that will work with Mountain Lion?

Joel posted a link here
http://forum.openframeworks.cc/t/ofxopenni-on-os-x-mountain-lion–10.8/10944/0

But does his link http://creativec0d1ng.blogspot.no/2012/08/installing-openni-on-osx-lionmountain.html

Install things at system level?

I need be able to make a portable app using openNi that will work on another Mac without having to install xcode & all those bits.

Any advice would be welcome,

thanks

Hey Chris
The creativecoding blog link is installing at system level - The Xcode part is just so you can run Make/the install scripts from the OpenNI downloadable binaries

I haven’t done it in a while but here are some links I have kept around on the process of making the libs portable
https://github.com/gameoverhack/OpenNI/commit/795b6ab1c0ee007eb761021dcf95b5614a372a6e

http://forum.openframeworks.cc/t/running-ofxopenni-/6687/10

Hmm, thats still a rather complicated process isn’t it :slight_smile:

Why is there no system installer that is just packaged & installs the drivers/openni/nite without the need for xcode/building etc?

By the way, does anyone else using ofxOpenNi get really long load times when they start their app? Is this because of the dylibs? I’m talking about 3 minutes. Would installing at system level make this faster?

Hey Chris

I’m really sorry, but I’m not running 10.8, so not much use to you right now. I suspect a new version of openNI will come out in the not too distant future that will work with Mountain Lion. In the meantime I will see what I can find out and try to source a 10.8 machine to test with. I guess it’s a silly question - but do you need to be running 10.8?

As to slow load times - I really don’t think it matters where the dylibs are loaded from: my ‘portable’ version and the system version are identical except for where the headers search for the dylibs to load from.

3 minutes sounds excessive!!! Certainly openNI takes a little longer than many apps to load - but i find it’s around 10 to 15 seconds on my systems.

What computer are you running things on?

hey matt thanks for your reply,

i think you’d probably need 10.8 to make sure they work.

joel posted a link to this install fro mountain lion
http://creativec0d1ng.blogspot.no/2012/08/installing-openni-on-osx-lionmountain.html

& i found this on google
https://gist.github.com/3237633

compiling the dylibs is going to be too complex for me, but it like a fairly easy way to install in the system that will work with your ofxOpenNi.

will installing it that way work with your addon?

the first link you have to install “Command line tools for Xcode” but not in the 2nd. Do you know if it is needed?

thanks!

Hi, I’ve been playing around with ofxOpenNI a while… but I need to resetTrackedUser and saw on another post that Experimental Branch will do this…

But the program stucked at the very first line:

[ofxOpenNIDevice[0]:NOTICE] Init context…

And bring a Windows message that openNISample007.exe stoped working.

I have Windows 7 64 bits, Code::Blocks, OF 0072 and AVIN2 0.92 5.0.1.25 32 bits installed.
With MASTER Branch, all is working fine.

Any sugestions what I’m doing wrong?

Cheers,
Daniel

I forgot to mention: all examples will bring this error.

Hi,

Using experiental branch, osx 10.8, SDK 10.6.

I need some more performance, so I tried to switch to 320x240 resolution by changing the width and height parameters in ofxOpenNI.cpp, like so:

  
  
    width = XN_QVGA_X_RES;  
    height = XN_QVGA_Y_RES;  
  

However, the generators gives me erros:

  
  
[ofxOpenNIDevice[0]:notice] Adding generator typeXN_NODE_TYPE_IMAGE  
[ofxOpenNIDevice[0]:verbose] Creating XN_NODE_TYPE_IMAGE generatorstatus:OK  
[ofxOpenNIDevice[0]:verbose] Setting Image1 resolution: 320 x 240 at 30fpsstatus:OK  
[ofxOpenNIDevice[0]:verbose] Starting XN_NODE_TYPE_IMAGE generatorstatus:**Device Protocol: Bad Parameter sent!**  
[ofxOpenNIDevice[0]:notice] Adding generator typeXN_NODE_TYPE_DEPTH  
[ofxOpenNIDevice[0]:verbose] Creating XN_NODE_TYPE_DEPTH generatorstatus:OK  
[ofxOpenNIDevice[0]:verbose] Setting Depth1 resolution: 320 x 240 at 30fpsstatus:OK  
[ofxOpenNIDevice[0]:verbose] Starting XN_NODE_TYPE_DEPTH generatorstatus:**Device Protocol: Bad Parameter sent!**  
[ofxOpenNIDevice[0]:verbose] Depth generator is not on  
....  
  

Any ideas?

Thanks!

EDIT:
Is there a fast way to get the masks of all users? Drawing this in an fbo takes sometimes more then 15 ms.

  
  
                int numUsers = kinect.getNumTrackedUsers();  
                for (int nID = 0; nID < numUsers; nID++){  
                    ofxOpenNIUser & user = kinect.getTrackedUser(nID);  
                    user.drawMask();  
                }  
  
  

Hi all.

I’m using new version of ofxOpenNI, on master branch. It’s great!
But I can’t find the way to control a tilt motor of Kinect.
This way is removed? Should I impriment that using usblib?

Thanks.

@mactkg: yes, sorry it was removed from the new API - just a lack of time on my part…would be great to get going again - I’m sure there’s a way to get working for PC as well, but on Mac it shouldn’t take too much work to convert from the old code…

@Kj1: I need to re-look at width/height settings - the setResolution function isn’t implemented as there were problems with stability, and I also started hard coding certain values to improve performance - so I’d need to calculate and store those values per device to make it work now…

Seems strange to take 15ms to draw all the masks - where are you doing the draw to the FBO? Before or after calling update on the kinect? How many users do you have?

Thanks gameover. I cannot give more details, the code is long gone and I switched to the windows platform for the MS kinect SDK. The performance win by doing kinect code on windows and streaming resutls to OSX using ethernet was huge.

I do seem to remember the timing issues in drawing the pixels to the fbo was bad coding on my part and not an issue of your code, so you don’t have to look into that.

@gameover:
Thanks for your reply!
I understood, and will use old code of ofxOpenNI.

Hey there,

I have a problem when executing my ofxOpenNI app in laptops with OpenGL 1.4. It’s
shocking because OpenNI/NITE demos work just fine in the same laptop. The problem
is that my app runs but does not show the depth and RGB images, and the image
processing inside the programm is not working because the results are not the expected.
Does any of you guys know something about this? Theres a OpenGL 2.1 or higher
requirement for ofxOpenNI? If so, for which part of the code?

Thanks, Iago

@iago,
afaik, there shouldn’t be any issues with opengl as long as you can run the OF examples, or any other OF app.
openni doesn’t deal directly with opengl, it’s OF that bridges between both.

best!