hey all, I've been really enjoying processing :)... here's a program I wrote that does some, I guess, basic pixellations with realtime video. You can change the size of the x and y grid by the variables at the top. You can also make it draw ellipses instead of rects if you like, too. ok, so this is the baby step, now to think of something cooler than these basic things to do with this.. :)
Quote:
/* webcam pixelator!! wait, is there a faster way to do this?
// steve cooley
// 2006-05-06
*/
import processing.video.*;
Capture myCapture;
// split the screen by:
int gridsizex = 16;
int gridsizey = 48;
// String rectorellipse = "rect";
String rectorellipse = "ellipse";
void setup()
{
framerate(10);
size(640/2, 480/2, P3D);
println(Capture.list()); // to output which cam is connected, then copy that text into the string below
String s = "IIDC FireWire Video";
myCapture = new Capture(this, s, width, height, 30);
noStroke();
rectMode(CORNER);
}
void captureEvent(Capture myCapture) {
myCapture.read();
}
//
// get the size of the window
// divide the window by x across and y down
// for every time in the x and y divisions, get the pixel color at that location
// draw a box (or ellipse) on that spot with that color
//
void draw() {
image(myCapture, 0, 0);
// fill(0);
// rect(0,0,width,height);
for(int y = 0; y<height; y=y+(height/gridsizey))
{
// println(y);
for(int x = 0; x<width; x=x+(width/gridsizex))
{
// println(x);
color cp = get(x, y);
fill(cp);
if(rectorellipse == "rect")
{
rect(x, y, width/gridsizex, height/gridsizey);
}
else
{
ellipse(x, y, width/gridsizex, height/gridsizey);
}
}
}
}