OpenNI delivers with some samples. All samples are placed under the 'Samples' folder, and their binaries can be found under 'Samples\Bin\Debug' or 'Samples\Bin\Release'. Most samples use an XML file to configure OpenNI. This file can be found at '%OPEN_NI_INSTALL_DIR%\Data\SamplesConfig.xml'. All samples, except for NiCRead, are written using the C++ interface.

Here is a short description of each sample:


NiSimpleRead is very basic. It configures OpenNI using the SamplesConfig XML file, and then takes the depth generator node (it assumes there is one. If not, the sample will exit with an error). It then loops, reading new frames from the depth generator, and prints out the depth value of the middle pixel. The sample exists when the user presses 'ESC'.


NiSimpleCreate is an example of creating a production node programmatically in code, rather than using the SamplesConfig XML file. After creating a depth node, it reads from it like NiSimpleRead does.


NiCRead sample is exactly the same as NiSimpleRead, except for the fact it demonstrates the use of the C interface (instead of the C++ one).


NiSimpleViewer is a small OpenGL application which draws the depth maps and the image maps to the screen. It configures OpenNI using the SamplesConfig XML, but requires both depth and image to be present, both with the same resolution, and image node at RGB24 format. The application creates a histogram of the depth map and draws the frame using it to allow better visibility of the depth map.

The following keys can be used to control the application:

Key Description
1 Converts to OVERLAY mode, drawing depth map on top of the image map. It also sets depth view point to image view point (using the Alternative view point capability).
2 Draws only depth. It also turns off alternative view point.
3 Draws only image. It also turns off alternative view point.
Esc Closes the application


OpenNI User Guide and Documentation | Kinect Hacks

あと、このページの下の方にNiSimpleViewer, NiViewer, NiUserTrackerに関する日本語の説明が書いてあります。
OpenNI Tips

※2011/1/28 追記