Hi everyone!
I just been playing with video in processing to make something bigger I have in mind.
The thing is I could delay somehow the video saving everything as a picture and then playing it again but my first implementation, saving every cam frame into a PImage does not work! and I dont know why. I just save all the first 300 frames into PImage array and then when trying to play it I get the normal video instead the delayed one.
Another question is about which implementation would work better, saving everything as files or in memory? I have in mind maybe working with hd video, so perhaps is going to be a bit too much having everything in the memory, isnt it?
So about the file version is there any way of just saving the cam frames into files instead of the whole window content with saveFrame?
Here it is the code
Thanks everyone!
Quote:
import processing.video.*;
Capture cam;
PImage[] img;
int i = 0;
int q = 0;
void setup() {
size(640, 240);
cam = new Capture(this, 320, 240);
frameRate(30);
img = new PImage[301];
}
void draw() {
cam.read();
image(cam, 0, 0);
//store the image in the buffer
if (i < 300) {
img[i++] = cam;
//saveFrame("imagen###.jpg");
}
//play the buffer
else {
//image(img[q++], 320, 0);
println("imagen" + nf(q++ + 1, 3) +".jpg");
//image(loadImage("imagen" + nf(q++ + 1, 3) +".jpg"), 320, 0);
if (q > 300 - 1) i = q = 0;
}
}