Februar 23, 2012
size(704, 750); PImage img = loadImage("bradburybuilding_1989.jpg"); image(img, 0, 0); int[] hist = new int[256]; for (int i = 0; i < img.width; i++) { for (int j = 0; j < img.height; j++) { int bright = int(brightness(get(i, j))); hist[bright]++; } } int histMax = max(hist); stroke(255); for (int i = 0; i < img.width; i += 2) { int which = int(map(i, 0, img.width, 0, 255)); int y = int(map(hist[which], 0, histMax, img.height, 0)); line(i, img.height, i, y); }