OpenNI 1.5.7
Creating applications that uses OpenNI

This section describes how to set the environment for developing your own applications using OpenNI.

Windows: To Create a simple project that uses OpenNI in Visual Studio:

  1. Open a new project or an existing one with which you want to use OpenNI.
  2. In the Visual Studio menu, open the Project menu and choose Project properties.
  3. In the C/C++ section, under the General node, find the "Additional Include Directories" and add "$(OPEN_NI_INCLUDE)". This is an environment variable pointing to where OpenNI include directory is located (the default location will be: C:\Program files\OpenNI\Include).
  4. In the Linker section, under the General node, find the "Additional Library Directories" and add "$(OPEN_NI_LIB)". This is an environment variable pointing to where OpenNI libraries directory is located (the default location will be: C:\Program files\OpenNI\Lib).
  5. In the Linker section, under the Input node, find the "Additional Dependencies" and add OpenNI.lib
  6. If you wish to use an XML file to configure OpenNI, you can start from a basic one found under OpenNI Data folder (the default location will be: C:\Program files\OpenNI\Data). For additional information about OpenNI xml scripts, see Xml Scripts.
  7. Make sure to add the Additional Include and Library directories to both your Release and Debug configurations.
  8. Your code files should include XnOpenNI.h if using the C interface, or XnCppWrapper.h if using the C++ interface.

Linux: Compiling an application that uses OpenNI using gcc:

During compilation, the following arguments should be passed to gcc:

  1. Add OpenNI include files to the include dirs: -I/usr/include/ni
  2. Add OpenNI library to the linkage process: -lOpenNI
  3. If you wish to use an XML file to configure OpenNI, you can start from a basic one found under the Samples directory
    1. Go to the directory from which OpenNI was installed.
    2. Go to Samples/Config
    3. Use the SamplesConfig.xml file as a reference. For additional information about OpenNI xml scripts, see Xml Scripts.
  4. Your code files should include XnOpenNI.h if using the C interface, or XnCppWrapper.h if using the C++ interface.