Kinect Mac OS X

Getting the Kinect working with Pd under Mac OS X unfortunately seems to be a bigger pain than with Linux or WIndows.

At the moment (May 2011) it appears to only be possible with Snow Leopard (OS X 10.6.x). So the first step is to upgrade to Snow Leopard.

Make sure you have XCode installed. It’s an optional install on the OS upgrade disk, so you have to do it on purpose. It’s also a free download from Apple.

Next, install CMake. Make is installed as part of XCode, but some of the stuff you need is made for CMake.

Next, install MacPorts, a package repository tool. A lot of programs are distributed via MacPorts, so you may have it installed already. If not, this is a good thing to have.

Next, install Git For Mac. Git is a package/code repository tool which is very popular amongst open source software developers. Note that if you had Git installed for Mac OS 10.5 when you upgraded to Snow Leopard, you have to upgrade to the newest version for 10.6. This incompatibility was screwing me up initially.

The other big problem I had was a USB library that was expected by the OpenNI drivers, but wasn’t installed on my system. It probably gets installed by other projects, so is somewhat common. The library is called usblib-1.0.0, but there are at least three libraries with that name, and they are all incompatible.

The best instructions for getting everything installed is at Kinecthesis. Here are the steps:

  • git clone git://git.libusb.org/libusb.gitgit clone git://github.com/OpenKinect/libfreenect.git
  • cd libusb
  • patch -p1 < ../libfreenect/platform/osx/libusb-osx-kinect.diff
  • ./autogen.sh
  • make
  • sudo make install
  • cd ../libfreenect (note there is a typo at the web site)
  • mkdir build
  • cd build
  • cmake ..
  • make && sudo make install

Sudo is like saying “please” to your computer. You may be prompted for your password. If all goes well, you can then test it with this:

  • glview

You should get a pair of iamges, side-by-side. One is the regular RGB camera, the other is the depth camera. Something like this:
Kinect Self Portrait

Then you can install the OpenNI library. There are instructions here, but there’s some overlap with the above. Simply put, here’s what you do:

Download the latest “unstable” OpenNI binaries for Mac OS X (this is the part that only supports Snow Leopard). For me, this was called OpenNI-Bin-MacOSX-v1.1.0.41.tar.bz2, but they update it all the time and it might vary for you. Put it in a folder called OpenNI (or something like that), then navigate to that folder and do this:

  • tar vxf OpenNI-Bin-MacOSX-v1.1.0.41.tar.bz2
  • sudo ./install.sh

You should get something like this:

Installing OpenNI
****************************

copying shared libraries…OK
copying executables…OK
copying include files…OK
creating database directory…OK
registering module ‘libnimMockNodes.dylib’…OK
registering module ‘libnimCodecs.dylib’…OK
registering module ‘libnimRecorder.dylib’…OK

*** DONE ***

Now for SensorKinect. Download the source tarball and put it in a SensorKinect folder. My download was called avin2-SensorKinect-28738dc.tar.gz, but they update it all the time and it may vary for you.

  • tar vxf avin2-SensorKinect-28738dc.tar.gz
  • cd avin2-SensorKinect-28738dc.tar.gz
  • cd Bin
  • tar vxf SensorKinect-Bin-MacOSX-v5.0.1.32.tar.bz2
  • sudo ./install.sh

Again, you should get a DONE message.

I’m not sure you need NITE (the middleware part) but we can install that, too. Download the latest unstable version here. My download was called NITE-Bin-MacOSX-v1.3.1.5.tar.bz2, but they update it all the time, so it might vary for you.. Put it in a NITE folder.

  • cd NITE
  • tar vxf NITE-Bin-MacOSX-v1.3.1.5.tar.bz2
  • cd Nite-1.3.1.5
  • sudo ./install.sh

Look familiar? It should. Again, you’re looking for a DONE message.

Finally, we need OSCeleton. Click on the Download button and select the “osceleton-1.0_osx” package. This is the binary we need. It doesn’t matter where you put it, but you need to know where it is because you need it to use the rest of the stuff in Pd. Put it in a folder called osceleton.

  • cd osceleton
  • chmod a+x osceleton-1.0_osx

Now, if you type:

  • ./osceleton-1.0_osx

You’ll start seeing it working. If you don’t have a Kinect plugged, in you’ll get an error telling you to make sure the Kinect is plugged in. By default, the Kinect data will be sent to localhost on port 7110. You’ll need to make Pd listen to that port for the data. You can broadcast the data to another IP address or port, if you want to use it over a network. You can do ./osceleton-1.0_osx –help to see the options.

If all this went well, you should have the hacker-made OpenKinect drivers, and the OpenNI drivers installed, along with the official OpenNI drivers installed.

More information and sample patches coming.

10 Responses to Kinect Mac OS X

  1. Hi,

    If you could help me that would be great! I’m having trouble sending OSC message into PD.
    I am operating NITE through the terminal and it seems to be tracking perfectly.
    However when I drop in OSCeletor it doesnt seem to be sending any OSC messages to pd.
    This is what is happening in my terminal

    Andrew-Mc-Governs-MacBook:Bin andrewmcgovern$ cd Release
    Andrew-Mc-Governs-MacBook:Release andrewmcgovern$ ls
    NiViewer Sample-NiSimpleRead
    OpenNI.net.dll Sample-NiSimpleViewer
    Sample-NiAudioSample Sample-NiUserTracker
    Sample-NiBackRecorder SimpleRead.net.exe
    Sample-NiCRead SimpleViewer.net.exe
    Sample-NiConvertXToONI UserTracker.net.exe
    Sample-NiRecordSynthetic libSample-NiSampleModule.dylib
    Sample-NiSimpleCreate
    Andrew-Mc-Governs-MacBook:Release andrewmcgovern$ /Users/andrewmcgovern/Documents/OpenNI/OpenNI-Bin-MacOSX-v1-1.1.0.41/Samples/Bin/Release/Sample-NiUserTracker Warning: USB events thread – failed to set priority. This might cause loss of data…
    New User 1
    Pose Psi detected for user 1
    Calibration started for user 1
    Calibration complete, start tracking user 1

    After doing this I then drop in osceleton to the terminal but this doesnt seem to work. Any ideas on what I am doing wrong?

    I have set up udprecieve to the correct port in PD but its not recieving any messages.

    Any help would be great.

      • Glad to hear it! I’m at Maker Faire this weekend, so was going to have to wait until Tuesday to try and replicate it. What did you do to fix it?

        • Hi,

          Thanks for the reply it was pretty easy to fix it I just closed pd down opened it up again and then dragged OSCeleton into the terminal again and it worked fine.

          On a different topic

          I saw that your are part of a patching circle. I’m from Dublin and I am interested in starting a patching circle here that will be free for all. If you could give me any info on how you structure your session that would be great. Do you pick a different topic each session and everybody just chips in? Any help or advice would be great.

          Andy

  2. I installed libfreenect via Homebrew on OSX 10.6.8. I’m wondering if there is a way to install OpenNI, NIte, Sensebloom and OSCeleton via Homebrew too? Or a different build that will allow to get Kinect data into Pd.

    Thanks very much

  3. Hi, I had trouble when I tried to install NITE because of the license. I input the license I found from Internet, but it wouldn’t work. Do you know the license for the latest NITE or how can I get one? Thanks a lot!

  4. Pingback: Pratyush Delicious links for November 12, 2011 | Pratyush Kotturu - KE5YQZ

Leave a Reply to Leeya Cancel reply

Your email address will not be published. Required fields are marked *