// videobits // -- does a pointilism thing to the live video // // Scott "Jerry" Lawrence // http://www.cis.rit.edu/~jerry/Software/p5 // int ellipseSize = 6; // 6 is the first size ellipse that isn't square! // smaller values => more precise images, but longer to update (ie 2, 3) // larger values => messier images, but quicker updates (10, 12) // 6 is a good midpoint between them // (this is overridden below if the mouse button is pressed.) // setup - initialize stuff void setup() { size(320, 240); noBackground(); // persistant background noStroke(); // our ellipses will be solid colored fill(0); rect( 0, 0, width, height ); // clear the screen ellipseMode(CENTER_DIAMETER); // we need to draw ellipses from the center beginVideo( 160, 120, 30 ); // start up video capture } void loop() { for( int a = 0; a < 200 ; a++) { // random coordinate in the image int x = int( random(width) ); int y = int( random(height) ); // snag the source pixel color c = video.pixels[ (x/2) + ( (y/2) * video.width ) ]; // adjust the ellipseSize if the mouse button is pressed if (mousePressed) ellipseSize = 2+ ( (mouseX+mouseY) * 20) /(width+height); // set the location in the destination (with an ellipse) fill( c ); ellipse( x, y, ellipseSize, ellipseSize ); } }