2012年8月25日土曜日

OpenNI MultiViewer

Introduction

Recently, I bought a second Xtion Pro Live. In this page I describe a multi-viewer which captures images simultaneously from two devices. The viewer derives a 3D point cloud from a depth image, and displays it with corresponding colors obtained from an RGB image using the OpenGL.

Development Environment

  1. iMac
  2. Mac OS X 10.8.1
  3. Processor:3.06GHz Intel Core 2 Duo
  4. Memory:4GB
  5. Xcode4.4.1

Primary Libraries

  1. Boost
  2. OpenNI
  3. OpenGL

Source Code

Here is my source code. I confirmed that it works well on my machine.

Compile Options

Header Search Path:
Path Purpose
/usr/include/ni/ to include the OpenNI headers
/opt/local/include/ to include the Boost headers

Library Search Path:
Path Purpose
/opt/local/lib to link with the Boost libraries

To use the OpenGL, I also set "-framework OpenGL" and "-framework GLUT." More detailed information is in my source code.

Usage

An executable file name is "OpenNiMultiViewer." Running it with an argument --help, it prints the following statements. After connecting two devices with the computer, running it without any arguments, it opens two viewers for images captured by devices. To quit the application, type an escape key under the situation where the application focuses on viewers.

Addition

  1. To change the number of devices, you have to extend my code.
  2. My application paints white color in the region where the device is unable to take the depth.
  3. The Xtion Pro Live uses infrared ray to take the depth. If there is more than one device, the number of regions where the devices are unable to take the depth increases because of interference between infrared rays.

0 件のコメント:

コメントを投稿