Today we are setting up openFrameworks to work with the MS Kinect depth camera.
Grab OF from openframeworks.com/downloads and the following OF Kinect addons:
- ofxKinect: uses open source libfreenect, provides RGB and Depth images (direct download)
- ofxOpenNI: uses close source Primesense OpenNI, provides RGB and Depth images plus a skeleton finder (direct download)
Note: These addons currently only work for Mac and Linux (ofxKinect). We will be working on getting Windows versions shortly.
Uncompressing the openFrameworks zip gives you the OF folder layout:
/addons --- where to place ofx addons /apps --- apps be here /libs /other /scripts
Uncompress ofxKinect and ofxOpenNI and place them in the /addons folder.
Building and Running Apps
You can try any of the example apps in /apps/examples or /example/addonsExamples.
Open the project file in the an example folder with you environment of choice:
- Mac: XCode .xcodeproj
- Linux: Codeblocks .workspace
- Windows: Visual Studio .sln, Codeblocks .workspace
Build the example and run it. Some examples have 2 project files, one for OF 0062 and one for OF 007 beta. Make sure to use the project file for the correct OF version you have.
Note: If you are using XCode and don’t like how it uses multiple windows, I recommend using the All-In-One layout. Set this in Preferences by:
If the Layout dropdown box is grey, close all the XCode windows then open the preferences again.
Creating a New App
The easiest way to create a new app project is to copy an example to your apps folder. The /apps/examples/emptyExample project is a bare bones project which is a good start. Copy the emptyExample folder into /apps/myApps.
To rename to project on Mac:
- rename the project folder
- open the project in XCode and rename it in Projects->Rename
If you want to use an addon, look for one of the addon examples. ofxKinect and ofxOpenNI for instance have example project folders which you can use to start.
Adding an Addon to an Existing App
- in XCode, create a new Group for the addon ie “ofxOpenCV” by right clicking on addons under the source tree and selecting Add->New Group
- drag the src and lib directories from the addon folder in the Finder into the Group you created in XCode
Some external (ofx*) libraries have special instructions such as ofxOpenNI in their README files. Make sure to double check these when using addons which are not included with OF by default.