Februar 26, 2012
Dieses Processing Programm liest ein .ogv Video aus und stellt das Bild mit ASCII zeichen dar.import pogg.*; int resolution = 6; float upscale = 2.5; String characters[] = { "・","-",":","+","x","#","@" }; int padding = 7; TheoraMovie movie; PImage img; PFont font; void setup() { movie = new TheoraMovie(this,"movie.ogv"); size(int(movie.width*upscale),int(movie.height*upscale)); colorMode(HSB,resolution); font = loadFont("Monaco-10.vlw"); textFont(font); textAlign(CENTER,CENTER); frameRate(movie.fps); movie.loop(); } void draw() { movie.read(); background(0); int rows = int(movie.height*upscale/padding+1); int cols = int(movie.width*upscale/padding+1); for(int row=0; row < rows; row++) { for(int col=0; col < cols; col++) { int prow = int(map(row,0,rows,0,movie.height)); int pcol = int(map(col,0,cols,0,movie.width)); int p = prow*movie.width+pcol; int c = movie.pixels[p]; int br = int(brightness(c)); int x = col*padding; int y = row*padding; text(characters[br],x,y); } } }