processing 视频 2d 像素化

import processing.video.*;
Movie m;

void setup() {
size(640, 360);
background(0);
// Load and play the video in a loop
m = new Movie(this, "892677437.mp4");
m.loop();
}

void movieEvent(Movie m) {
m.read();
}

void draw() {
//if (movie.available() == true) {
// movie.read();
//}
image(m, 0, 0, width, height);
m.loadPixels();
int pixelSize = 20;
float sizemult = 3;
for (int y = 0;y for (int x = 0;x int mPixelPos=y*m.width+x;

color pixCol=m.pixels[mPixelPos];
float pixBrightness=255-brightness(pixCol);
fill(pixCol);
rect(x,y,pixelSize,pixelSize);

}
}
}

你可能感兴趣的:(processing 视频 2d 像素化)