import processing.video.*;
Movie myMovie;
void setup() {
size(320,240, P2D);
myMovie = new Movie(this, "mymovie.mov");
myMovie.loop();
}
void draw() {
if(myMovie.available()) {
myMovie.read();
}
image(myMovie, 0, 0);
loadPixels();
changeColor();
}
void changeColor() {
for (int i = 0; i < width * height; i++) {
color p = pixels[i];
all2RGB(p,i);
}
}
void all2RGB(color p, int i) {
float r = red(p);
float g = green(p);
float b = blue(p);
if (r >= g && r >= b) {
pixels[i] = color(255,0,0);
return;
}
if (g >= r && g >= b) {
pixels[i] = color(0,255,0);
return;
}
if (b >= r && b >= g) {
pixels[i] = color(0,0,255);
return;
}
}
20 januari 2010
Real time video processing
This one is for Sarah and Hsien so you can process videos real time.
Abonneren op:
Reacties posten (Atom)
Geen opmerkingen:
Een reactie posten