Thanks for your help. We've received your bug report.

Register for a C74 account and join an active community of artists and creatives. Post on forums and add your projects and tools to our growing showcase.

Create an Account

jit.openni (inc. Kinect)

by

This is a Max Jitter external for OpenNI on Windows and Mac OSx.

Currently supports:

  • Configuration of OpenNI by an OpenNI XML configuration file; see OpenNI documentation for format
  • ImageMap of RGB24 output in a 4-plane char jitter matrix
  • DepthMap output in a 1-plan long, float32, or float64 jitter matrix
  • IrMap output in a 1-plan long, float32, or float64 jitter matrix
  • UserPixelMap output in a 1-plan long, float32, or float64 jitter matrix
  • Skeleton joints in an OSC, native max route, or legacy OSCeleton format
  • Skeleton events in an OSC, native max route, or legacy OSCeleton format (e.g. user seen, user lost, calibration success, etc.)
  • User centers of mass
  • Scene floor identification and data
  • Values for user centers of mass and joints in OpenNI native, projective coordinate, or OSCeleton legacy “normalized” values
  • Attributes to filtering data based on position or orientation confidence, display or not the orientation data, and smooth skeleton data using OpenNI’s smoothing API
  • Depth camera field of view
  • Compiled as a Win32 and Mac OSx max/jitter external

https://github.com/diablodale/jit.openni/wiki is the location of the project documentation and setup instructions.

Example of some OSC joint output:
/userid/jointname x y z confidPosition [Xx Xy Xz Yx Yy Yz Zx Zy Zz orientPosition]

It has been casually tested with Max 5 and 6, SensorKinect, and OpenNI binaries on Windows and Mac OSx. If you find problems and can reproduce them with clear steps, I encourage you to open an issue at https://github.com/diablodale/jit.openni/issues

This external’s output is very similar to jit.freenect.grab and therefore it can often be used in its place with small changes. My object outputs depth in mm and jit.freenect.grab outputs in cm. A simple math operation can resolve this. Note, my object does not provide the “raw” values of jit.freenect.grab; instead it provides the mm depth values via OpenNI.

The OSC skeleton data should be easy to use if you are familiar with OSCeleton.

I would like to see support for other generators (gestures, hand point, etc.) in the future added by myself or with the assistance of others.

DISCUSSION

17 Comments

stoersignal says:

any chance to get a mac verrsion of this?

diablodale says:

I would like to see a Mac developer join the jit.openni project and make any needed changes for it to be cross-platform. I do not have the equipment or resources for any Mac development myself.

steve says:

i was wondering if you had anyone join the mac side of dev? i would like to get involved with this.
your patch looks amazing but i can not use it on mac.
let mw know what i can do. where are you at? have you had any mac forks started?

talk soon

diablodale says:

I haven’t yet connected with an interested Mac developer. They keep using separate programs like OSCeleton or the freenect which doesn’t have skeletons. I understand its easier to use what is already there.

Physically, I’m located in Berlin. VIrtually, I’m worldwide. ;-)

steve says:

Hey ,
i was reading some of your documentation (as thats all i can do at this point on mac)
and was wondering where this jit.simple came from?
and if maybe i could get that working on the mac,
if i can get to some documentation about the maxsdk (which i can not find)
let me know.
i also emailed you.

Nathan says:

Any further news on a Mac version? Using freenect.grab at the moment and being tortured by the memory leak bug.

div says:

Would also love to see a Mac version if there’s one about!

Looks great!

diablodale says:

Still no Mac developer has volunteered or contacted me to compile it, check for errors, and make any needed tweaks.

parmerud says:

Is there any Mac developer out there that want to make a bit of money? I will pay to have this great external moved into Mac land if no one cares to move just for knowledge and fun. Come on! All the Mac community that have a Kinect will jump for joy…. Just go to my website to get my contact info.
PS I HATE CAPTCHA!!!!!

Stuart White says:

Hey DiabloDale. Thanks for sharing this great Max object. I’m unfortunately on the Mac side of things so I haven’t used it myself yet.

About a year ago, I spent a little time trying to get this to compile for Mac and got pretty close without having to make many tweaks. Eventually I hit a roadblock and started working on something else. First let me say, I’m not a hardcore coder, I can sort of tweak stuff from time to time, but I couldn’t create what you did from scratch. That’s why I use Max.

So after commenting out the “#include “targetver.h” instances, there were only a few spots I had to replace “boolean” with “bool”. Besides that it seems to line up.

Where I hit the wall was a few errors “Redefinition of typedef XnModuleExportedProductionNodeInterface”. I did some searches on the OpenNI forums and such and saw a few other people asking about this error, but never getting an answer. I was so determined to just see it compile, I went into the OpenNI includes and changed a few to get rid of these errors and got it to compile. The object does show up in patch fine, the summary command works, but I can’t load the jit.openni_config.xml file, even if I pointed right at it, I would get the file not found error. I suspect that has to do with all my tweaks to the ProductionNodeInterface stuff. Without that, the camera never tries to initialize. That’s where I moved onto another project where I made a bunch of tweaks to Synapse to output the depth data in more formats.

Anyways, I’m back and am going to give it another go. You have already done the hard stuff. The OpenNI/NITE libraries are huge and at times hard to follow. I’m hoping once I can get past this “Redefinition of typedef XnModuleExportedProductionNodeInterface” error it should compile on the Mac. Thanks again for sharing the source.

Stuart

Stuart White says:

Hello again DiabloDale.

I’m happy to report I now have jit.openni running on my Mac in OSX 10.68 (Snow Leapord) . I’m currently testing on Max 5.18 + Max 6.07, OpenNI v1.540, Nite v1.5.2.21. All seems good so far, no crashes, launches correctly each time. (knock on wood) I even tried reloading the xml file over and over and it just takes a second or two to come back online each time. Skeleton data starts outputting within seconds.

At the end of the day, I didn’t have to change much to get it functioning, I just had to learn a lot more about OpenNI as well as debugging Max externals. This was a good first project for compiling a Max external from PC source in OSX. Once I got past the Redefinition errors by commenting out one of the includes in the OpenNI headers, “XnUtils.h” to be specific, I at least had it building the .mxo which loaded into the example patch.

From there I had to figure out why I was getting “File not Found” from OpenNI. After inserting a bunch of breakpoints in the source and stepping through them, I noticed that the file path for the jit.openni_config.xml was in a format that OpenNI couldn’t understand. I.E Macintosh HD:/folder/jit.openni_config.xml. I then just replaced the s->s_name field with the filename in quotes in the xnContextRunXmlScriptFromFileEx call. At that point I noticed that it seemed to take longer for it to error with a different error than I got before. Almost seemed like OpenNI was going through the OpenNI Context + ProductionNode stuff then getting stuck.

Then I remembered you mentioning in one of the posts about the new version of OpenNI caused an issue whereas you had to modify the xml file to remove the Scene Node stuff. I did that tried it again and was excited to see the laser fire up. I didn’t notice that the metro in the help patch was set to 500 ms. by default, which caused it to run at 2 fps. I didn’t care at that moment, I at least had it all running and then left to pick up the kids with a smile on my face. As soon as I got home I spotted the metro and was totally relieved I didn’t have to spend the night figuring out why it was running slow. It runs nice and fast 30fps and higher with all the stuff on at 640 480.

I really like that your object takes advantage of auto skeleton acquire which now longer needs the cactus pose, that came with last years updates to OpenNI/Nite. I just installed the latest version the other night and am really impressed how much they improved the skeleton tracking since v1 + v2. I also noticed they got it booting up much faster now. When I launch one of the OpenNI samples such as “Sample-NiUserTracker”, it boots up the kinect and is tracking a skeleton in 2-3 seconds tops. It used to take like 10 seconds to launch and fire up the kinect, then 5 seconds – 30minutes to acquire a skeleton ;-)

So although it seems to be running good, I currently have it hacked to find the ” jit.openni_config.xml” file at the root level of the HD, ie “Macintosh HD”. I need to figure out how to format the name/path so OpenNI can read an OSX path correctly. In the meantime, Mac users can just put it at the root of their HD like I did. I also want to figure out how to include all the binaries and bits so users won’t have to do the whole install MacPorts, OpenNI, Nite, and Sensor Driver in the terminal. Since I’m not a very good in C and Xcode, more of a node based guy, I will have to stumble through it like I did with getting this object going. I think that step will be worth it since that is such a painful process for the guys who just want to plug in the kinect and start Maxing, not spending hours installing all that stuff. I’ll learn more about that by looking at the ofx OpenFrameworks examples which have an external bin folder of the needed bits. That would even be acceptable, say in the “max-externals” folder. In the meantime, users can use if they have the OpenNI/Nite libraries installed on their machines.

I think tonight I’ll expand on your example patch and max a proper .maxhelp patch. I noticed you already wrote message handles to all the things I’m most interested in. Perhaps I’ll add in the tilt motor control some day and some more skeleton output formats. Before I took us this project again, I was using NI-Mate for skeleton data and working out the rotation angles of each joint to make them bvh mocap compatible and better suited to control rigged 3d models. Using position to animate a 3d character is pretty ugly imo. Even though NI-Mate is a wonderful app, I wanted all the data at the same time including the 11 bit depth data, which non of them supply as far as I know. NI-Mate, Synapse, Osceleton.

Let me know how you want to release this, it’s your baby. Do you want to make a separate forks on git.hub or would you rather modify one set of source files that have the built in platform checks? I’ll clean up what I’m working on and can pass it to you at any time.

Cheers

Stuart

stuart@controlfreaksystems.tv

diablodale says:

Stuart, your email address stuart@controlfreaksystems.tv is bouncing. Do you have another email?

Stuart White says:

My bad, I was pretty tired last night stuart@controlfreak.tv

diablodale says:

We got a working Mac OSx port of this external. Its ready for broader testing/release. Full info in normal locations and as listed here in this toolbox.

Barry Farrimond says:

This is amazing, thanks so much guys! Quick recommendation for anyone that cares, I found the installation process on github to be a little confusing owing to my lack of knowledge regarding terminal. Can I recommend Zigfu to anyone else who is also having problems in this regard, http://zigfu.com/en/downloads/browserplugin/ it installs everything you need to get going through a more “conventional” installer process i.e one download, one installation. After that one installation you can open upo the max patch and a way you go!

Vagelis says:

I have downloaded and used jit.openni And it’s really amazing and very useful combined with kinect. I have created an application in max/msp in which I use kinect to get data. I have the PMD Camboard nano depth sensor and i have already connect it with the openni. I would like to know if i can use your jit.openni with this specific depth sensor. I have already tried to connect it but without any results. What could I do to make it work. Any help would be appreciated.

Thanks
Vagelis

diablodale says:

@Vagelis, pleases open an issue at https://github.com/diablodale/jit.openni/issues where I can better support you.

Leave a Reply