Saving each frame to a movie file is exactly what we are aiming for. And then playback the progress until the last frame with a press on a button.
And when done save it to a file
The installation is meant for children so it has to be pretty bullet proof. Our plan was to make an installation with three buttons:
Record a frame ( i have implemented this in the code including sound playback and an union skin that is projected on the surface with a projector )
Play all frames until the last frame so children can see what they have done before ( this will be projected on a surface with the same projector that projects the union-skin. )
Save the project ( save the project to a movie file, preferring flash, and upload it to a website, this means that each movie has to be saved separately and the working space has to be reset "new project" )
So things i need to program now are: save frame to a movie, and the option to playback frames when pressed on a button.
I see the script you send me in your previous reply, but i dont exactly understand how i can implement this in my code so each frame will be saved to one movie file? Sorry for all the questions but i am new to this. I appreciate your help with this!
Is anyone needs it this is my latest code including sound playback:
Quote:// TINY STOP-FRAME PROGRAM
// Saves an image from the camera when a key/mouse is pressed.
// For Processing Version 1.01.
//----------------------------------------------------------
// Parameters you can modify:
int videoWidth = 1280; // could be 160, 320, 640, etc.
int videoHeight = 800; // could be 120, 240, 480, etc.
int onionSkinTransparency = 0; // between 0 and 255
//----------------------------------------------------------
import processing.video.*;
PImage previousImage;
Capture myCapture;
int saveCount = 0;
boolean bDoSave = false;
boolean bReady = false;
//SOUND CODE----------------------------------------------------------
import ddf.minim.*;
Minim minim;
AudioSample foto;
AudioSample play;
AudioSample upload;
//----------------------------------------------------------
void setup(){
myCapture = new Capture(this, videoWidth,videoHeight);
size(myCapture.width,myCapture.height);
previousImage = new PImage(myCapture.width,myCapture.height);
//SOUND CODE----------------------------------------------------------
minim = new Minim(this);
foto = minim.loadSample("camera.wav", 2048);
play = minim.loadSample("bloop.wav", 2048);
upload = minim.loadSample("boing.wav", 2048);
}
//----------------------------------------------------------
void keyPressed(){
if ( key == 'f' ) bDoSave = true;
if ( key == 'f' ) bReady = true;
//SOUND CODE----------------------------------------------------------
if ( key == 'f' ) foto.trigger();
if ( key == 'p' ) play.trigger();
if ( key == 'u' ) upload.trigger();
}
void mousePressed(){
bDoSave = false;
bReady = true;
}
//----------------------------------------------------------
void draw()
{
if(myCapture.available()) {
myCapture.read();
if (bReady) {
//draw black frame
background(0);
bReady = false;
bDoSave = true;
} else if (bDoSave) {
//capture image
noTint();
image(myCapture, 0,0);
String filename = "stopframe_" + nf(saveCount++, 5) + ".jpg";
saveFrame(filename);
bDoSave = false;
previousImage.loadPixels();
arrayCopy (myCapture.pixels, previousImage.pixels);
previousImage.updatePixels();
} else {
//draw previous image
noTint();
image(previousImage, 0,0);
tint(255, 255, 255, onionSkinTransparency);
image(myCapture, 0,0);
}
}
}
//SOUND CODE----------------------------------------------------------
void stop()
{
// always close Minim audio classes when you are done with them
foto.close();
minim.stop();
super.stop();
}