// ui: click screen for settings, hit any key to "split" video // parameters int[] cameraSize = {320, 240}; int fpsInput = 20; // fps to poll the camera at (approximately) int avgBits = 5; // exposure length. 0 is standard time lapse, 7 averages 128 frames int speedUp = 15; // frames between saving exposure. int codec = MovieMaker.JPEG; // JPEG, H263 int quality = MovieMaker.BEST; // BEST, LOSSLESS int fpsOutput = 30; // fps of output file // ohare: fpsin:24,bits:5,speed:15,fpsout:30 (18.75) // chicago takeoff: fpsin:20,bits:5,speed:18,fpsout:30 (27) // la to sd: chicago,speed:15 // the rest import JMyron.*; import moviemaker.*; JMyron cam; MovieMaker movie; int avgLength = (int) pow(2, avgBits); int[][] sum, prev; int pos; int len; void setup(){ size(cameraSize[0], cameraSize[1]); frameRate(fpsInput); cam = new JMyron(); cam.start(width,height); cam.findGlobs(0); len = width * height; sum = new int[len][3]; prev = new int[avgLength][len]; pos = 0; println(avgLength + " frames every " + speedUp); float ratio = speedUp * ((float) fpsOutput / (float) fpsInput); println(ratio + " seconds of real time per second of viewing time."); nextMovie(); } void draw(){ cam.update(); int[] img = new int[len]; arraycopy(cam.image(), img); (new ProcessFrame(img)).start(); } void mousePressed() { cam.settings(); } void keyPressed() { nextMovie(); } public void nextMovie() { if(movie != null) movie.finishMovie(); movie = new MovieMaker(this, width, height, (int) random(1000) + "_lapse.mov", codec, quality, fpsOutput); } public void stop(){ cam.stop(); super.stop(); }