// Thanks to Daniel Shiffman for the video manipulation example //Van Gogh Pallette by Oya Kosebay //Will work with processing 1.5 //The palette captures a picture of you using a mouse click then starts to draw it using the brush strokes // Import video library import processing.video.*; Capture video; PImage portrait; int counter = 0; int pointillize =17; // the variable for the size of the brush stroke void setup() { size(810,987); video = new Capture(this,width,height,30); portrait = createImage (video.width,video.height,RGB); frameRate(200); // to make the random picking go faster //img = loadImage (portrait); } void draw() { // if you want the palette to be picking using a the video not just a capture /* if (video.available()) { video.read(); } */ // Pick a random point int x = int(random(video.width)); int y = int(random(video.height)); int loc = x + y*video.width; // Look up the RGB color in the source image loadPixels(); float r = red(video.pixels[loc]); float g = green(video.pixels[loc]); float b = blue(video.pixels[loc]); noStroke(); // Draw a brush stroke at that location with that color fill(r,g,b,100); rectMode(CENTER); rect(x,y,pointillize,pointillize*2); // the size is created by the variable } // capture a picture to draw using a mouse click void mousePressed () { if (video.available()) { video.read(); } //image(video,0,0); } void keyPressed () { if (key == 'S' || key == 's') { save("portrait" + counter + ".jpg"); println ("saved"); counter++; } }