Kinect: Neither run nor show any error

edited October 2013 in Kinect

Hi,

I have here tried integrating wiki triangulation library with user blob code so I wrote this code. Here, this code neither run nor show any error. Any thoughts !

    import SimpleOpenNI.*;
    import org.processing.wiki.triangulate.*;
    ArrayList triangles = new ArrayList();
    ArrayList points = new ArrayList();
    SimpleOpenNI  kinect;
    int userID;
    Boolean tracking=false;
    int[] userMap = null;
    void setup() {
      size(640, 480, P3D);
      kinect = new SimpleOpenNI(this);
      kinect.enableDepth();
      kinect.enableUser(SimpleOpenNI.SKEL_PROFILE_NONE);
    }

    void draw() {
      background(0);
      kinect.update();
      if (kinect.getNumberOfUsers()>0) {
        userMap = kinect.getUsersPixels(SimpleOpenNI.USERS_ALL);  // find out which pixels have users in them// populate  the pixels array
        // from the sketch's current contents
        loadPixels();
        for (int x=0; x<width; x++) {
          for (int y=0; y<height; y++) {
            int index = x + y * width;
            if ( userMap!=null &&  userMap[index] > 0) {
              points.add(new PVector(x, y));
              pixels[index] = color(255, 0, 0);
            }
          }
        }
        updatePixels();
      }
      if (points.size()>0) {
        //-------------------------------
        triangles = Triangulate.triangulate(points);
        //-------------------------------
        stroke(0, 40);
        fill(255, 40);
        beginShape(TRIANGLES);
        for (int i = 0; i < triangles.size(); i++) {
          Triangle t = (Triangle)triangles.get(i);
          vertex(t.p1.x, t.p1.y);
          vertex(t.p2.x, t.p2.y);
          vertex(t.p3.x, t.p3.y);
        }
        endShape();
      }
      //-------------------------------
    }
    void onNewUser(int uID) {
      userID = uID;
      tracking = true;
      println("tracking");
    }

Comments

  • A lot has changed with the new version of SimpleOpenNI. Are you using 1.96? If so the above code won't work. :)>-

  • But can you please tell me what could be the possible problem.

    thanks !

  • I can try.... and please don't take this reply the wrong way... there is help here...

    If you're using processing 2.03 and you installed SimpleOpenNI 1.96 using the instructions found here, remembering uninstall all the old drivers/programs, and you didn't forget to install OpenNI 2 SDK, you should be able to run OpenNI's SimpleViwer sample program to make sure the kinect is working.

    Then you should make sure that you add the SimpleOpenNI lib through processing's add library feature, so have the latest version.

    Now if you look at the SimpleOpenNI javadocs and examples, you'll see that the skeleton tracking has been simplified, the user tracking has been changed a bit, as well as the events calls.

    Good luck. :)

  • Hunter I had tried I know what was the problem. Because of too many points it gets hang. Any help ?

  • edited October 2013

    Need more info... not sure what you are asking

  • edited October 2013

    Here I have installed as per your suggestion Kinect sdk 1.7 with SimpleOpenNI 1.96 . Now I have got other problems such as old SimpleOpenNI 0.27's examples are not running and shows a lot of errors ....

    • SimpleOpenNI.SKEL_PROFILE_ALL not found
    • _context.startPoseDetection does not exists
    • _context.endPoseDetection
    • context.enableUser(SimpleOpenNI.SKEL_PROFILE_ALL)
    • context.enableHands()
    • context.enableGesture()
    • context.addGesture("RaiseHand")
    • context.addGesture("Wave")
    • context.addGesture("Click")

    these all are do not exists ... any fix

    I have mention in this thread

Sign In or Register to comment.