/* * Oblivion * by Paolo Tonon. */ int w = 780; int h = 532; int numberBox = 12; // int maxX =int(w/numberBox); int maxY =int(h/numberBox); int largeur; float camX,camY,camZ; Cube[][] cubes = new Cube[maxX][maxY]; float spaceX = w/maxX; float spaceY = h/maxY; // int puntoX = 1; int puntoY = 1; boolean versoX = true; boolean versoY = true; /* * Background Subtraction * by Golan Levin. */ import processing.video.*; int numPixels; int[] backgroundPixels; int[] storedPixels; Capture video; static public void main(String args[]) { PApplet.main(new String[] { "--present", "oblivion" }); } void setup(){ size(w,h,P3D); colorMode(RGB,255); frameRate(20); largeur= width/maxX-(width/maxX)/maxX; camZ=(height/2.0) / tan(PI*60.0 / 360.0); for (int i = 0; i > 16) & 0xFF; int currG = (currColor >> 8) & 0xFF; int currB = currColor & 0xFF; // Extract the red, green, and blue components of the background pixel’s color int bkgdR = (bkgdColor >> 16) & 0xFF; int bkgdG = (bkgdColor >> 8) & 0xFF; int bkgdB = bkgdColor & 0xFF; // Compute the difference of the red, green, and blue values int diffR = abs(currR - bkgdR); int diffG = abs(currG - bkgdG); int diffB = abs(currB - bkgdB); // Add these differences to the running tally presenceSum += diffR + diffG + diffB; // Render the difference image to the screen storedPixels[i] = 0xFF000000 | (diffR << 16) | (diffG << 8) | diffB; } //updatePixels(); // Notify that the pixels[] array has changed //println(presenceSum); // Print out the total amount of movement translate(largeur,largeur,-100); for (int i = 0; i 100){ z=100; } else if(z<-800){ z=-800; } color blackReference = color (40); if(cubeColor > blackReference){ step=(30); } else{ step=-(10); } } }