O'Reilly logo

OpenNI Cookbook by Soroush Falahati

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Recording streams to file (ONI file)

We learned about playing ONI files but it was only a part of this topic. You can record ONI files from the device's outputs yourself too. We will now introduce an openni::Recorder class that can be used for this purpose. This recipe is easy, as adding and starting openni::VideoStream involves nothing special.

Getting ready

Create a project in Visual Studio 2010 and prepare it for working with OpenNI using the Creating a project in Visual Studio 2010 recipe of Chapter 2, Open NI and C++.We don't need OpenGL in this recipe.

How to do it...

  1. Add the following lines above your source code (just below the #include lines):
    char ReadLastCharOfLine() { int newChar = 0; int lastChar; fflush(stdout); do { lastChar = newChar; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required