diff --git a/User.pde b/User.pde index 10bde2c..13920a9 100644 --- a/User.pde +++ b/User.pde @@ -1,44 +1,66 @@ /* -------------------------------------------------------------------------- * SimpleOpenNI User Test * -------------------------------------------------------------------------- - * Processing Wrapper for the OpenNI/Kinect library + * Processing Wrapper for the OpenNI/Kinect 2 library * http://code.google.com/p/simple-openni * -------------------------------------------------------------------------- - * prog: Max Rheiner / Interaction Design / zhdk / http://iad.zhdk.ch/ - * date: 02/16/2011 (m/d/y) + * prog: Max Rheiner / Interaction Design / Zhdk / http://iad.zhdk.ch/ + * date: 12/12/2012 (m/d/y) * ---------------------------------------------------------------------------- */ -void setupUser(){ - if(multiThread){ - context = new SimpleOpenNI(this,SimpleOpenNI.RUN_MODE_MULTI_THREADED); - }else{ - context = new SimpleOpenNI(this); +color[] userClr = new color[] { + color(255, 0, 0), + color(0, 255, 0), + color(0, 0, 255), + color(255, 255, 0), + color(255, 0, 255), + color(0, 255, 255) +}; +PVector com = new PVector(); +PVector com2d = new PVector(); + +void setupUser() +{ + if (multiThread) { + context = new SimpleOpenNI(this, SimpleOpenNI.RUN_MODE_MULTI_THREADED); + } + else { + context = new SimpleOpenNI(this); } //context = new SimpleOpenNI(this); - context.setMirror(mirror); //mirrors view but not joint names; that must be done separately - + context.setMirror(mirror); //mirrors view but not joint names; that must be done separately + + if (context.isInit() == false) + { + println("Can't init SimpleOpenNI, maybe the camera is not connected!"); + exit(); + return; + } + // enable depthMap generation context.enableDepth(); - + // enable skeleton generation for all joints - context.enableUser(SimpleOpenNI.SKEL_PROFILE_ALL); - - background(200,0,0); + context.enableUser(); + + background(200, 0, 0); - stroke(0,0,255); + stroke(0, 0, 255); strokeWeight(3); //smooth(); - - //size(context.depthWidth(), context.depthHeight()); } -void drawUser(){ +void drawUser() +{ // update the cam context.update(); - + // draw depthImageMap + //image(context.depthImage(),0,0); + image(context.userImage(), 0, 0); + ///*---------- instead of context.userImage() ???? if(modePreview){ if(camDelayCounter