Production Level Knowledge & Tips

  1. 未分類
  2. 3 view

[Kinect][Processing][Windows]Set up

Install

We have to install following software to use Kinect with processing.
  • OpenNI : The library for using Kinect
  • NITE : The library for recognizing gesture and etc.
  • SensorKinect : device driver
  • Simple-OpneNI : The library to use Kinect with processing
We can install these installer on following URL.
https://code.google.com/p/simple-openni/downloads/list
  1. Download OpenNI_NITE_Installer-xxx-0.27.zip
  2. After unpack the zip file, install openNI with double clicking openni-xxx-1.5.4.0-dev.msi
  3. Install NITE with double clicking nite-xxx-1.5.2.21-dev.msi
  4. Install device driver with double clicking SensorKinect092-Bin-xxx-v5.1.2.1.msi
  5. Download SimpleOpenNI-0.27.zip and unpack it
  6. Copy the got folder to libraries under processing’s root folder

Let’s try a little bit interesting sample

Let’s write program for detecting user and paint it.
import SimpleOpenNI.*;

SimpleOpenNI context;
color[] userColors = { color(255,0,0), color(0,255,0), color(0,0,255), color(255,255,0), color(255, 0, 255), color(0, 255, 255) };

void setup() {
  context = new SimpleOpenNI(this);
  context.setMirror(false);
  context.enableDepth();
  context.enableUser(SimpleOpenNI.SKEL_PROFILE_ALL);
  size(context.depthWidth(), context.depthHeight());
}

void draw() {
  context.update();
  image(context.depthImage(), 0, 0);

  int[] userMap = null;
  int userCount = context.getNumberOfUsers();
  if (userCount > 0) {
    userMap = context.getUsersPixels(SimpleOpenNI.USERS_ALL);
  }

  loadPixels();
  for (int y=0; y<context.depthHeight(); y++) {
    for (int x=0; x<context.depthWidth(); x++) {
      int index = x + y * context.depthWidth();

      if (userMap != null && userMap[index] > 0) {
        int colorIndex = userMap[index] % userColors.length;
        pixels[index] = userColors[colorIndex];
      }
    }
  }
  updatePixels();
}
kinectsample1
The program’s result is like following.
Similar program is written by following book.

未分類 recent post

  1. Install sbt 1.0.0 and run sample template

  2. Visualization of Neural Network and its Train…

  3. [Machine Learning]Created docker image includ…

  4. [Node.js]How to write batch script with Node.…

  5. [Hive]Get top n items for each category

関連記事

PAGE TOP