nikuyoshiのブログ

記事の内容については個人の見解であり、所属企業の意見を代表するものではありません

OpenNIのサンプルプログラムに関するメモ書き

どうもこんばんは、nikuyoshiです。

探しても探しても、OpenNIのサンプルプログラム全てに関するメモ書きが無いぞ!と思っていたらありました。きちんとOpenNIフォルダ内のDocumentationフォルダにありました。きちんと見ようね!!samples.htmlに書いてあります。

OpenNI-Bin-Dev-MacOSX-v1.4.0.2/Documentation/html/samples.html

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

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

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

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

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のバージョンと異なる可能性があるのでオススメしませんが、探すのが面倒な方はpdfファイルがあるのでこちらのページへどうぞ。
OpenNI User Guide and Documentation | Kinect Hacks

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

※2011/1/28 追記
OpenNI公式のドキュメントサイトを発見しました。Kinectとの位置づけやライブラリ全体の概要を把握できそう。
http://openni.org/Documentation/home.html