We are about to switch to a new forum software. Until then we have removed the registration on this forum.
setMirror() seems to have no effect either way. What am I missing? I can't get a mirror image regardless of true or false setting. Please help!!
import SimpleOpenNI.*;
SimpleOpenNI kinect; int userId;
void setup() { size(640, 480); kinect = new SimpleOpenNI(this); kinect.enableDepth(); kinect.enableUser(); kinect.setMirror(true);
stroke(255, 0, 0); strokeWeight(3); smooth(); } void draw() { background(0); kinect.update(); kinect.setMirror(false);
IntVector userList = new IntVector(); kinect.getUsers(userList); if (userList.size() > 0) { userId = userList.get(0); if ( kinect.isTrackingSkeleton(userId)) { drawSkeleton(); } } }
// SimpleOpenNI events --------------------------------------------
void onNewUser(SimpleOpenNI kinect, int userId) { // did originally say curContext from user library kinect_User_02 println("onNewUser - userId: " + userId); println("\tstart tracking skeleton"); kinect.startTrackingSkeleton(userId); } void onLostUser(SimpleOpenNI kinect, int userId) { println("onLostUser - userId: " + userId); }
void drawSkeleton() {
kinect.drawLimb(userId, SimpleOpenNI.SKEL_HEAD, SimpleOpenNI.SKEL_NECK);
kinect.drawLimb(userId, SimpleOpenNI.SKEL_NECK, SimpleOpenNI.SKEL_LEFT_SHOULDER); kinect.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_SHOULDER, SimpleOpenNI.SKEL_LEFT_ELBOW); kinect.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_ELBOW, SimpleOpenNI.SKEL_LEFT_HAND);
kinect.drawLimb(userId, SimpleOpenNI.SKEL_NECK, SimpleOpenNI.SKEL_RIGHT_SHOULDER); kinect.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER, SimpleOpenNI.SKEL_RIGHT_ELBOW); kinect.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_ELBOW, SimpleOpenNI.SKEL_RIGHT_HAND);
kinect.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_SHOULDER, SimpleOpenNI.SKEL_TORSO); kinect.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER, SimpleOpenNI.SKEL_TORSO);
kinect.drawLimb(userId, SimpleOpenNI.SKEL_TORSO, SimpleOpenNI.SKEL_LEFT_HIP); kinect.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_HIP, SimpleOpenNI.SKEL_LEFT_KNEE); kinect.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_KNEE, SimpleOpenNI.SKEL_LEFT_FOOT);
kinect.drawLimb(userId, SimpleOpenNI.SKEL_TORSO, SimpleOpenNI.SKEL_RIGHT_HIP); kinect.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_HIP, SimpleOpenNI.SKEL_RIGHT_KNEE); kinect.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_KNEE, SimpleOpenNI.SKEL_RIGHT_FOOT); }
Answers
Sorry about the formatting. I missed the markup feature
Click on edit and select your code and hit ctrl+k to format your code.
Questions
Just check if this is working. Also why did you setMirror property in draw() ? You just have to do it once, in setup only. So if you want to change it then change it in the setup.