import org.openkinect.freenect.*; import org.openkinect.processing.*; import processing.serial.*; //zadig 2.0.1 libusbK https://zadig.akeo.ie/downloads/ Serial sPort; Kinect kinect; // Depth image PImage depthImg; PImage depthImgRaw; PImage videoImg; public enum Mode { DEPTHCOLOR, NEARESTIMAGECOLOR } Mode mode=Mode.DEPTHCOLOR; boolean leftview_depth=true; boolean enable_mirrorImage=true; boolean enable_IRImage=false; boolean enable_colordepth=false; // Which pixels do we care about? int minDepth = 0; int maxDepth = 910; // What is the kinect's angle float angle; static int boxnum=50; //maximum boxes int boxnumloaded=boxnum; //can be changes if less boxes are loaded from config color box[] = new color[boxnum]; int boxid[] = new int[boxnum]; PVector boxpos[] = new PVector[boxnum]; //center position of box PVector boxsize[] = new PVector[boxnum]; //size of box (width,height) boolean boxenabled[] = new boolean[boxnum]; float[] depthLookUp = new float[2048]; static int FRAMERATE=20; //int fadetime=1000/FRAMERATE /10; //fadetime in centiseconds int fadetime=1000/FRAMERATE /10 *4; //fadetime in centiseconds SMOOOOTH int editbox=0; //num of box boolean editboxpos=false; //editmode int infomessagecounter=0; //counts every frame String infomessage=""; void setup() { size(1280, 480); frameRate(FRAMERATE); colorMode(HSB, 255); kinect = new Kinect(this); kinect.initDepth(); kinect.initVideo(); kinect.enableMirror(enable_mirrorImage); kinect.enableIR(enable_IRImage); kinect.enableColorDepth(enable_colordepth); angle = kinect.getTilt(); // Blank image depthImgRaw = new PImage(kinect.width, kinect.height); depthImg = new PImage(kinect.width, kinect.height); for (int i=0;i