Kinect sdk v1.7 & SimpleopenNI 1.96 with SimpleopenNI 0.27 examples occured a lot of errors. Help!

edited October 2013 in Kinect

Hi everyone,

I have installed Kinect sdk 1.7 with simpleopenNi 1.96 everything thing is working but some example from old SimpleOpenNI 0.27 "SimpleOpenNI>example>OpenNI>Usercallback3D.pde" is not working and show lot of missing function can anyone help me to fix it ..its urgent.

I am using windows 8 64 bit with processing 2.0.1 64 bit

Errors :

  • SimpleOpenNI.SKEL_PROFILE_ALL not found
  • _context.startPoseDetection does not exists
  • _context.endPoseDetection does not exists

In other examples where --

  • context.enableUser(SimpleOpenNI.SKEL_PROFILE_ALL);
  • context.enableHands();
  • context.enableGesture();
  • context.addGesture("RaiseHand");
  • context.addGesture("Wave");
  • context.addGesture("Click");

all these above error show up ..... please can you tell me the fix

        /* --------------------------------------------------------------------------
         * SimpleOpenNI User3d Callback Test
         * --------------------------------------------------------------------------
         * Processing Wrapper for the OpenNI/Kinect library
         * http://code.google.com/p/simple-openni
         * --------------------------------------------------------------------------
         * prog:  Max Rheiner / Interaction Design / zhdk / http://iad.zhdk.ch/
         * date:  11/13/2011 (m/d/y)
         * ----------------------------------------------------------------------------
         * this demos shows to make callback to other Objects than PApplet
         * ----------------------------------------------------------------------------
         */

        import SimpleOpenNI.*;


        SimpleOpenNI context;
        float        zoomF =0.5f;
        float        rotX = radians(180);  // by default rotate the hole scene 180deg around the x-axis, 
        // the data from openni comes upside down
        float        rotY = radians(0);

        // this object deals with the user callbacks
        UserManager  userManager;

        void setup()
        {
          size(1024, 768, P3D);  // strange, get drawing error in the cameraFrustum if i use P3D, in opengl there is no problem
          context = new SimpleOpenNI(this);

          // setup the callback helper class
          userManager = new UserManager(context);

          // disable mirror
          context.setMirror(false);

          // enable depthMap generation 
          if(context.enableDepth() == false)
          {
             println("Can't open the depthMap, maybe the camera is not connected!"); 
             exit();
             return;
          }

          // enable skeleton generation for all joints, direct all callback to the helper class
          context.enableUser(SimpleOpenNI.SKEL_PROFILE_ALL,
                             userManager);

          stroke(255, 255, 255);
          smooth();  
          perspective(radians(45), 
                      float(width)/float(height), 
                      10, 150000);
        }

        void draw()
        {
          // update the cam
          context.update();

          background(0, 0, 0);

          // set the scene pos
          translate(width/2, height/2, 0);
          rotateX(rotX);
          rotateY(rotY);
          scale(zoomF);

          int[]   depthMap = context.depthMap();
          int     steps   = 3;  // to speed up the drawing, draw every third point
          int     index;
          PVector realWorldPoint;

          translate(0, 0, -1000);  // set the rotation center of the scene 1000 infront of the camera

          stroke(100); 
          for (int y=0;y < context.depthHeight();y+=steps)
          {
            for (int x=0;x < context.depthWidth();x+=steps)
            {
              index = x + y * context.depthWidth();
              if (depthMap[index] > 0)
              { 
                // draw the projected point
                realWorldPoint = context.depthMapRealWorld()[index];
                point(realWorldPoint.x, realWorldPoint.y, realWorldPoint.z);
              }
            }
          } 

          // draw the skeleton if it's available
          int[] userList = context.getUsers();
          for(int i=0;i<userList.length;i++)
          {
            if(context.isTrackingSkeleton(userList[i]))
              drawSkeleton(userList[i]);
          }    

          // draw the kinect cam
          context.drawCamFrustum();
        }

        // draw the skeleton with the selected joints
        void drawSkeleton(int userId)
        {
          strokeWeight(3);

          // to get the 3d joint data
          drawLimb(userId, SimpleOpenNI.SKEL_HEAD, SimpleOpenNI.SKEL_NECK);

          drawLimb(userId, SimpleOpenNI.SKEL_NECK, SimpleOpenNI.SKEL_LEFT_SHOULDER);
          drawLimb(userId, SimpleOpenNI.SKEL_LEFT_SHOULDER, SimpleOpenNI.SKEL_LEFT_ELBOW);
          drawLimb(userId, SimpleOpenNI.SKEL_LEFT_ELBOW, SimpleOpenNI.SKEL_LEFT_HAND);

          drawLimb(userId, SimpleOpenNI.SKEL_NECK, SimpleOpenNI.SKEL_RIGHT_SHOULDER);
          drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER, SimpleOpenNI.SKEL_RIGHT_ELBOW);
          drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_ELBOW, SimpleOpenNI.SKEL_RIGHT_HAND);

          drawLimb(userId, SimpleOpenNI.SKEL_LEFT_SHOULDER, SimpleOpenNI.SKEL_TORSO);
          drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER, SimpleOpenNI.SKEL_TORSO);

          drawLimb(userId, SimpleOpenNI.SKEL_TORSO, SimpleOpenNI.SKEL_LEFT_HIP);
          drawLimb(userId, SimpleOpenNI.SKEL_LEFT_HIP, SimpleOpenNI.SKEL_LEFT_KNEE);
          drawLimb(userId, SimpleOpenNI.SKEL_LEFT_KNEE, SimpleOpenNI.SKEL_LEFT_FOOT);

          drawLimb(userId, SimpleOpenNI.SKEL_TORSO, SimpleOpenNI.SKEL_RIGHT_HIP);
          drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_HIP, SimpleOpenNI.SKEL_RIGHT_KNEE);
          drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_KNEE, SimpleOpenNI.SKEL_RIGHT_FOOT);  

          strokeWeight(1);
        }

        void drawLimb(int userId, int jointType1, int jointType2)
        {
          PVector jointPos1 = new PVector();
          PVector jointPos2 = new PVector();
          float  confidence;

          // draw the joint position
          confidence = context.getJointPositionSkeleton(userId, jointType1, jointPos1);
          confidence = context.getJointPositionSkeleton(userId, jointType2, jointPos2);

          stroke(255, 0, 0, confidence * 200 + 55);
          line(jointPos1.x, jointPos1.y, jointPos1.z, 
          jointPos2.x, jointPos2.y, jointPos2.z);

          drawJointOrientation(userId, jointType1, jointPos1, 50);
        }

        void drawJointOrientation(int userId, int jointType, PVector pos, float length)
        {
          // draw the joint orientation  
          PMatrix3D  orientation = new PMatrix3D();
          float confidence = context.getJointOrientationSkeleton(userId, jointType, orientation);
          if (confidence < 0.001f) 
            // nothing to draw, orientation data is useless
            return;

          pushMatrix();
          translate(pos.x, pos.y, pos.z);

          // set the local coordsys
          applyMatrix(orientation);

          // coordsys lines are 100mm long
          // x - r
          stroke(255, 0, 0, confidence * 200 + 55);
          line(0, 0, 0, 
          length, 0, 0);
          // y - g
          stroke(0, 255, 0, confidence * 200 + 55);
          line(0, 0, 0, 
          0, length, 0);
          // z - b    
          stroke(0, 0, 255, confidence * 200 + 55);
          line(0, 0, 0, 
          0, 0, length);
          popMatrix();
        }

        // -----------------------------------------------------------------
        // Keyboard events

        void keyPressed()
        {
          switch(key)
          {
          case ' ':
            context.setMirror(!context.mirror());
            break;
          }

          switch(keyCode)
          {
          case LEFT:
            rotY += 0.1f;
            break;
          case RIGHT:
            // zoom out
            rotY -= 0.1f;
            break;
          case UP:
            if (keyEvent.isShiftDown())
              zoomF += 0.01f;
            else
              rotX += 0.1f;
            break;
          case DOWN:
            if (keyEvent.isShiftDown())
            {
              zoomF -= 0.01f;
              if (zoomF < 0.01)
                zoomF = 0.01;
            }
            else
              rotX -= 0.1f;
            break;
          }
        }

        // -----------------------------------------------------------------
        // UserManager

        public class UserManager
        {
          protected SimpleOpenNI  _context;
          boolean                 _autoCalib=true;

          public UserManager(SimpleOpenNI context)
          {
            _context = context;
          }

          public void onNewUser(int userId)
          {
            println("onNewUser - userId: " + userId);
            println("  start pose detection");

            if(_autoCalib)
              _context.requestCalibrationSkeleton(userId,true);
            else    
              _context.startPoseDetection("Psi",userId);  

          }

          public void onLostUser(int userId)
          {
            println("onLostUser - userId: " + userId);
          }

          public void onExitUser(int userId)
          {
            println("onExitUser - userId: " + userId);
          }

          public void onReEnterUser(int userId)
          {
            println("onReEnterUser - userId: " + userId);
          }

          public void onStartCalibration(int userId)
          {
            println("onStartCalibration - userId: " + userId);
          }

          public void onEndCalibration(int userId, boolean successfull)
          {
            println("onEndCalibration - userId: " + userId + ", successfull: " + successfull);

            if (successfull) 
            { 
              println("  User calibrated !!!");
              _context.startTrackingSkeleton(userId);
            } 
            else 
            { 
              println("  Failed to calibrate user !!!");
              println("  Start pose detection");
              _context.startPoseDetection("Psi", userId);
            }
          }

          public void onStartPose(String pose, int userId)
          {
            println("onStartdPose - userId: " + userId + ", pose: " + pose);
            println(" stop pose detection");

            _context.stopPoseDetection(userId); 
            _context.requestCalibrationSkeleton(userId, true);
          }

          public void onEndPose(String pose, int userId)
          {
            println("onEndPose - userId: " + userId + ", pose: " + pose);
          }
        }

Answers

  • edited May 2015

    so I found some of the answer by myself if anyone needs ANSWERS (Click on the answer)

    but still some of the things I still not able to work help.... or can anyone provide documentation or tutorial for SimpleOpenNI 1.96 version please I have done up gradation and I want to use new SimpleOpenNI badly please help ..or atleast mention the changes in new library that would be great !

  • Changes in New library

    - version 0.2x ----- version 1.9x

    • enableScene() -------------> enableUser()
    • sceneImage() -------------> userImage()
  • Answer ✓

    Blyk, there has never been much documentation for simpleOpenNI other then the Javadocs and examples. I know its hard for beginners, I went through the same issues. But it seems like you're on the right track now :)

  • Can you provide some other changes please do so ..........

  • Hello blyk. I have the same problem... error:SimpleOpenNI.SKEL_PROFILE_ALL not found You seems solved this problem. What did you do?

  • if you are trying to run SimpleOpenNI 0.27 example with new Verison of SimpleOpenNI 1.96 then it would not gonna work because Kinect 1.x sdk doesn't support this and new OpenNI wrapper has also made some changes. Here

  • in the example User3d I see

    // enable skeleton generation for all joints context.enableUser();

    It seems that enableUser() now defaults to SKEL_PROFILE_ALL

  • Exactly ! jorrebor

  • Hi all here my first post in this forum. Similar to this thread, so didn't want to start a new one. Hopefully someone can help.

    Installed SimpleOpenNI and processing2.1 on linux64. I'm trying to run a sketch by a friend of mine. But I get strange errors:

    The function requestCalibrationSkeleton(int, boolean) does not exist

    This is strange because there's no trace of this error on Internet... anybody with a suggestion?

  • edited January 2014

    Calibration is no longer needed. Remove all the callbacks that work with calibration exept onNewUser. This code works for me:

    void onNewUser(SimpleOpenNI kinect,int userId) {

    kinect.startTrackingSkeleton(userId);

    }

  • @vollfed thanks please add more :)

  • @tama thank you very much ...please keep udating this post for other user :)

  • I have faced this problem too.Do you find ways to solve it?

  • edited April 2015
    
    //"Code from Making Things See" by Greg Borenstein(MAKE)
    //Copyright 2012 Greg Borenstein, 978-1-449-30707-3
    
    import SimpleOpenNI.*;
    SimpleOpenNI  kinect;
    void setup() {
      size(640, 480);
      kinect = new SimpleOpenNI(this);
      kinect.enableDepth();
      // turn on user tracking
      kinect.enableUser();
    }
    void draw() {
      kinect.update();
      PImage depth = kinect.depthImage();
      image(depth, 0, 0);
      // make a vector of ints to store the list of users
      IntVector userList = new IntVector();
      // write the list of detected users
      // into our vector
      kinect.getUsers(userList);
      // if we found any users
      if (userList.size() > 0) {
        // get the first user
        int userId = userList.get(0);
        // if we’re successfully calibrated
        if ( kinect.isTrackingSkeleton(userId)) {
          // make a vector to store the left hand
          PVector rightHand = new PVector();
          // put the position of the left hand into that vector
          float confidence = kinect.getJointPositionSkeleton(userId, 
          SimpleOpenNI.SKEL_LEFT_HAND, 
          rightHand);
          // convert the detected hand position
          // to "projective" coordinates
          // that will match the depth image
          PVector convertedRightHand = new PVector();
          kinect.convertRealWorldToProjective(rightHand, convertedRightHand);
          // and display it
          fill(255, 0, 0);
          ellipse(convertedRightHand.x, convertedRightHand.y, 10, 10);
        }
      }
    }
    /* old version user-tracking callbacks!
    void onNewUser(int userId) {
      println("start pose detection");
      kinect.startTrackingSkeleton(userId);
    }
    
    void onEndCalibration(int userId, boolean successful) {
      if (successful) {
        println("  User calibrated !!!");
        kinect.startTrackingSkeleton(userId);
      } else {
        println("  Failed to calibrate user !!!");
        kinect.startTrackingSkeleton(userId);
      }
    }
    void onStartPose(String pose, int userId) {
      println("Started pose for user");
      kinect.stopTrackingSkeleton(userId);
      kinect.requestCalibrationSkeleton(userId, true);
    }*/
    
    void onNewUser(SimpleOpenNI curContext,int userId)
    {
      println("onNewUser - userId: " + userId);
      println("\tstart tracking skeleton");
      
      kinect.startTrackingSkeleton(userId);
    }
    
    void onLostUser(SimpleOpenNI curContext,int userId)
    {
      println("onLostUser - userId: " + userId);
    }
    
    void onVisibleUser(SimpleOpenNI curContext,int userId)
    {
      //println("onVisibleUser - userId: " + userId);
    }
    
    

    https://code.google.com/p/simple-openni/issues/detail?id=76

    handTracking_kinect.pde author?: achalkii...@gmail.com

    I'm posting this because I had a hard time getting any information on how to make this example from "Making Things See" work, and I thought I'd share in case anyone else is having issues. Some of it was simple to change by googling errors where the library reference updated, but the callbacks were harder. The above link has the original information on how to edit the callbacks at the bottom of the sketch to work since it now doesn't need calibrations. Please check out their link.

    Edit: I'm sorry for how sloppy this is. I'm not sure how to post this so it looks like the code. I'll try to fix it, but otherwise it is all there, just messy. :/

Sign In or Register to comment.