/* bounding boxes is a simple object tracking example. point the camera at some big bright objects and the boxes will follow. last tested to work in Processing 0090 JTNIMOY */ import JMyron.*; import krister.Ess.*; //import processing.video.*; Channel myChannel; JMyron m;//a camera object int ctrWas=0; void setup(){ size(320,240); m = new JMyron();//make a new instance of the object m.start(width,height);//start a capture at 320x240 m.trackColor(0,0,0,100);//R, G, B, and range of similarity starts set to black m.minDensity(100); //minimum pixels in the glob required to result in a box m.maxDensity(500); //println("Myron " + m.version()); noFill(); // start up Ess the sound generator library Ess.start(this); myChannel=new Channel(); myChannel.initBuffer(myChannel.frames(5000)); } void draw(){ m.update(); //update the camera view drawCamera();//draw the camera to the screen strokeWeight(3); stroke(255,0,0); int[][] b = m.globBoxes();//get the center points for (int i=0;i0) {c=sort(c);} // c is the x values, sorted for(int i=0;ictr && (ctrWas != ctr) ) { // 240 - reverses the direction of the pitch with respect to y values myChannel.wave(Ess.TRIANGLE,(240-xy[ctr][1])*factor,1,0,myChannel.frames(100)); myChannel.play(); stroke(0,255,0); rect( b[bctr[ctr]][0] , b[bctr[ctr]][1] , b[bctr[ctr]][2] , b[bctr[ctr]][3] ); } ctrWas=ctr; // update } void drawCamera(){ int[] img = m.image(); //get the normal image of the camera loadPixels(); for(int i=0;i