Question

Before I get comments about the version of Simple-OpenNI that I'm using, I installed the only one that was on the Google Downloads page (v 1.96). I saw in another thread that I have to replace the line kinect.enableGesture() with kinect.startGesture(...) but then the other methods get messed up. I am following the book Arduino and Kinect Projects by Enrique Ramos Melgar, but that code doesn't seem to be up-to-date.

My affected code is as follows:

void setup() {
  kinect = new SimpleOpenNI(this);
  // enable mirror
  kinect.setMirror(true);
  // enable depth map, hands, and gestures
  kinect.enableDepth();
  kinect.enableGesture();
//  kinect.startGesture(SimpleOpenNI.GESTURE_WAVE);
  kinect.enableHands();
  // add focus gesture to start tracking
  kinect.addGesture("Wave");

  size(kinect.depthWidth(), kinect.depthHeight());
  String portName = Serial.list()[0];
  myPort = new Serial(this, portName, 9600);
}

void onRecognizeGesture(String strGesture, PVector idPosition, PVector endPosition) {
  kinect.removeGesture(strGesture);
  kinect.startTrackingHands(endPosition);
}

With the following errors:

The method enableGesture() is undefined for the type SimpleOpenNI
The method enableHands() is undefined for the type SimpleOpenNI
The method addGesture(String) is undefined for the type SimpleOpenNI
The method removeGesture(String) is undefined for the type SimpleOpenNI
The method startTrackingHands(PVector) is undefined for the type SimpleOpenNI
Was it helpful?

Solution

Be sure to start your code with

import SimpleOpenNI.*;
SimpleOpenNI kinect;

Then, you use methods which don't exist anymore in SimpleOpenNI 1.96, check the doc. Since the big update of OpenNi/Nite, SimpleOpenNi is totally different:

enableHands() is now enableHand(),

addGesture(String) is now startGesture(int gesture),

removeGesture(String) is endGesture(int gesture),

startTrackingHands(PVector) is startTrackingHand(float[] pos)

Nite is not yet implemented in simpleOpenNi 1.96, so as far as I know, I think there are only 3 gestures you can use, GESTURE_CLICK, GESTURE_HAND_RAISE, GESTURE_WAVE

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top