PImage b, c; float x,y,w; float r, theta; // variable for motion int n; int win_width; int win_height; int y_corner; // variables for auto-constrast int i_min, i_max; static float discard = 0.0001; PFont fontA; static int DIV = 4; static int JUMP_POINT = 40; //static int REST = 20; void setup() { size(screen.width/DIV, screen.height/DIV);//, 800); //b=loadImage("01_06_western landscape.jpg"); //b=loadImage("/home/robert/Desktop/Photos/03_washington dc bedroom 2.jpg"); b=loadImage("C:\\Swap\\Photos\\03_washington dc bedroom 2.jpg"); //b=loadImage("C:\\Swap\\Photos\\01_06_western landscape.jpg"); win_height=int(b.height*0.4/DIV); win_width=int(b.width*0.4/DIV); y_corner=0;//int((b.height-win_height)/2); x=0; y=0; n=0; r=0; theta=0; frameRate(24); // for frameRate display fontA = loadFont("CourierNew36.vlw"); textFont(fontA, 32); // store initial auto-contrast params c = b.get(round(x), round(y+y_corner), win_width, win_height); calc_contrast(c); } void calc_contrast(PImage in) { // adjust contrast in place on input image in.loadPixels(); // loop over pixels to find min and max Intensity int dimension = (in.width*in.height); int [] hist = new int[256]; for(int i=0;i> 16) & 0xFF; // Faster way of getting red(rgb) int g = (argb >> 8) & 0xFF; // Faster way of getting green(rgb) int b = argb & 0xFF; // Faster way of getting blue(rgb) int intensity=int((r+g+b)/3); hist[intensity]++; }; i_min=0; int threshold = int(dimension*discard); int sum=0; while(sum> 24) & 0xFF; //int bin_a = argb & 0xFF000000; int r = (argb >> 16) & 0xFF; // Faster way of getting red(rgb) int g = (argb >> 8) & 0xFF; // Faster way of getting green(rgb) int b = argb & 0xFF; // Faster way of getting blue(rgb) // int ac_min=constrain(ac_center-(ac_width>>1), 0, 255); // int ac_max=constrain(ac_center+(ac_width>>1), 0, 255); // r=int(constrain(map(r, ac_min, ac_max, 0, 255), 0, 255)); // g=int(constrain(map(g, ac_min, ac_max, 0, 255), 0, 255)); // b=int(constrain(map(b, ac_min, ac_max, 0, 255), 0, 255)); r=int(constrain(map(r, i_min, i_max, 0, 255), 0, 255)); g=int(constrain(map(g, i_min, i_max, 0, 255), 0, 255)); b=int(constrain(map(b, i_min, i_max, 0, 255), 0, 255)); a = (a) << 24; r = r << 16; g = g << 8; b = b; color new_rgb = a | r | g | b; in.pixels[i]= new_rgb; }; in.updatePixels(); }; void draw() { c = b.get(round(x), round(y+y_corner), win_width, win_height); calc_contrast(c); adjust_contrast(c); blend(c, 0, 0, win_width, win_height, 0, 0, width, height, BLEND); //blend(b, x, y+y_corner, (win_width), (win_height), 0, 0, width, height, BLEND); //filter(ERODE); //saveFrame("/Volumes/Swimming Pool/Processing/west-#####.tif"); //saveFrame("C:\\Data\\01_06_western landscape/01_06_western landscape-#####.tif"); //saveFrame("output\\03_washington dc bedroom 2-#####.tif"); //println(x+":"+b.width+" "+y+":"+b.height); fill(255); text(frameRate, 15, 20); if(n>JUMP_POINT) { r=random(30, 80); theta=random(HALF_PI*0.75, HALF_PI*1.25); n=0; }; // update motion x+=sin(theta)*r/((n+1)); y+=cos(theta)*r/((n+1)); n++; if(x+win_width>b.width) exit(); if(y