001.
Olle Essvik/
For Objects to Come

I write a new computer program inspired by the attic storage cleaning, a memory program consisting of two even squares connected to a camera. Square one represents real-time, what the camera sees. Square two is the past, captured in photographs. Each time you photograph a new object an old one disappears. Square two shows the most recent photos in a sequence, creating an animation.
import java.io.*;
import java.lang.*;
import processing.video.*;
PImage img;
Capture cam = new Capture(this, "Trust-kamera,size=640x512,fps=1");
// change animation speed
int filmSpeed= 145;
// change frames to be played
int numberFramesback= 5;
String namePic;
int timer;
int namepicPast=1;
int namepicFuture=0;
int namepicSAVE=0;
int lastPic;void setup() {
size (1440, 900);
background(255);
//Write your file path
File dir = new File("/Users/xessol/Desktop/files/Photos");
File[] files = dir.listFiles();
lastPic = files.length-1;
namepicSAVE = files.length-2;String[] cameras = Capture.list();
if (cameras.length == 0) {
exit();
} else {

for (int i = 0; i < cameras.length; i++) {
}
cam = new Capture(this, "Trust-kamera,size=640x512,fps=5");
cam.start();
}

} void keyReleased()
{
if (key == 'a' || key == 'A') {
File dir = new File("/Users/xessol/Desktop/files/Photos");
File[] files = dir.listFiles();
lastPic = files.length-1;
lastPic++;
namepicSAVE = lastPic-1;
cam.save("/Users/xessol/Desktop/files/Photos/"+lastPic+".jpg");
namepicPast++;
namepicFuture++;
}
if (key == 'b' || key == 'B') {
File f = new File("/Users/xessol/Desktop/files/Photos/"+lastPic+".jpg");
//println(f);
f.delete();
namepicFuture--;
namepicPast--;
namepicSAVE--;
}

if (key == 's' || key == 'S') {
filmSpeed--;
}

if (key == 'd' || key == 'D') {
filmSpeed++;
}

if (numberFramesback>1){
if (key == 'f' || key == 'F' ) {


numberFramesback--;
println(namepicSAVE);
} }
if (numberFramesback= filmSpeed) {
namepicFuture++;
namePic ="/Users/xessol/Desktop/files/Photos/"+namepicFuture+".jpg";
img = loadImage(namePic);
image(img, 780, 200,640,512);
timer = millis();
}
if (namepicFuture> namepicSAVE)
{namepicFuture-= numberFramesback;
}
if (cam.available() == true) {
cam.read();
}
image(cam, 20, 200);
//filter(GRAY);
}
Click here to download the software

Download pdf