hey i have been playing arround with code of greg borenstein
i want to have a circle behind the head i have a code in which currently i get circle i front can any body help!!
import SimpleOpenNI.*;
import processing.opengl.*;
SimpleOpenNI kinect;
void setup() {
size(640,480);
kinect = new SimpleOpenNI(this);
kinect.enableDepth();
kinect.enableRGB();
// turn on user tracking
kinect.enableUser(SimpleOpenNI.SKEL_PROFILE_ALL);
// turn on depth-color alignment
kinect.alternativeViewPointDepthToImage();
//size(640, 480);
//fill(255,0,0);
}
void draw() {
kinect.update();
// PImage depth = kinect.depthImage();
//image(depth,0,0);
PImage rgbImage = kinect.rgbImage();
image(rgbImage,0,0);
// prepare the color pixels
rgbImage.loadPixels();
loadPixels();
// 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 head
PVector rightHead = new PVector();
// put the position of the left head into that vector
kinect.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_HEAD, rightHead);
// convert the detected head position
// to "projective" coordinates
// that will match the depth image
PVector convertedRightHead = new PVector();
kinect.convertRealWorldToProjective(rightHead, convertedRightHead);
// and display it
ellipse(convertedRightHead.x, convertedRightHead.y, 200, 200);
//translate(rightHead.x, rightHead.y, rightHead.z);
//ellipse(20, 20, 300, 300);
}
}
}
// user-tracking callbacks!
void onNewUser(int userId) {
println("start pose detection");
kinect.startPoseDetection("Psi", userId);
}
void onEndCalibration(int userId, boolean successful) {
if (successful) {
println(" User calibrated !!!");
kinect.startTrackingSkeleton(userId);
} else {
println(" Failed to calibrate user !!!");
kinect.startPoseDetection("Psi", userId);
}
}
void onStartPose(String pose, int userId) {
println("Started pose for user");
kinect.stopPoseDetection(userId);
kinect.requestCalibrationSkeleton(userId, true);
}
1