Skeleton Tracking Processing 3.3.6 OSX

Comments

  • Cool video. Did you want to put this in Share Your Work? Is there sketch code associated with this that you wanted to share?

  • WoW amazing.

    Yes what did you use as libraries and dependencies? How your sketch look? And I was wondering how to send all the joints through OSC?

    I am trying this code that I tweaked a little:

    `import SimpleOpenNI.*; SimpleOpenNI kinect;

    PImage handImage;

    void setup() { kinect = new SimpleOpenNI(this); kinect.enableDepth(); kinect.enableUser(); kinect.setMirror(false); kinect.enableRGB();

    size(640, 480); smooth();

    handImage = loadImage("Hand.png"); } void draw() {

    kinect.update(); image(kinect.rgbImage(), 0, 0); IntVector userList = new IntVector(); kinect.getUsers(userList);

    if (userList.size() > 0) { int userId = userList.get(0);

    float rightArmAngle = getJointAngle(userId, SimpleOpenNI.SKEL_RIGHT_HAND, SimpleOpenNI.SKEL_RIGHT_ELBOW);
    PVector handPos = new PVector();
    kinect.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_RIGHT_HAND, handPos);
    PVector convertedHandPos = new PVector();
    kinect.convertRealWorldToProjective(handPos, convertedHandPos);
    
    //float newImageWidth = map(convertedHandPos.z, 500, 2000, handImage.width/6, handImage.width/12);
    //float newImageHeight = map(convertedHandPos.z, 500, 2000, handImage.height/6, handImage.height/12);
    
    float newImageWidth = convertedHandPos.z*0.1;
    float newImageHeight = convertedHandPos.z*0.2;
    
    newImageWidth = constrain(newImageWidth, 75, 100);
    
    pushMatrix();
      translate(convertedHandPos.x, convertedHandPos.y);
      rotate(rightArmAngle*-1);
      rotate(PI/2);
      image(handImage, -1 * (newImageWidth/2), 0 - (newImageHeight/2), newImageWidth, newImageHeight);
    popMatrix();
    

    } }

    float getJointAngle(int userId, int jointID1, int jointID2) { PVector joint1 = new PVector(); PVector joint2 = new PVector(); kinect.getJointPositionSkeleton(userId, jointID1, joint1); kinect.getJointPositionSkeleton(userId, jointID2, joint2); return atan2(joint1.y-joint2.y, joint1.x-joint2.x); }

    // user-tracking callbacks: void onNewUser(int userId) { kinect.startTrackingSkeleton(userId);

    }`

    But I got this error message

    The file "Hand.png" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable. Isochronous transfer error: 1

    If you guys have some ideas to help a newbie could be nice

    Keep up the good work totovr

Sign In or Register to comment.