storing each frame of a movie in an array
in
Core Library Questions
•
7 months ago
I'm having trouble with reading a short movie and storing each frame in an array of images. I can't tell whether the program is only copying the first frame (I think it is at least doing this) or something else. I can't seem to get it to play back by displaying each iteration of the array sequentially. Here is the line that should copy the frame:
gifs[i]=mov.get(0,0,mov.width,mov.height);
Here is the full program
int maxImages = 277;
int imageIndex = 0;
import processing.video.*;
Movie mov;
//Movie gifs[];
PImage[] gifs = new PImage[maxImages];
void setup(){
size(320,240);
mov = new Movie(this, "cat.mov");
mov.loop();
}
void draw(){
color(0);
//image(mov,0,0, 320, 240);
for (int i = 1; i < 250; i ++ ) {
gifs[i]=mov.get(0,0,mov.width,mov.height);
println("we are in here "+i);
// }
}
for (int i = 1; i < 250; i ++ ) {
//image(gifs[i],0,0, 320, 240);
//println(i);
gifs[i]=mov.get(0,0,mov.width,mov.height);
image(gifs[i],0,0, 320, 240);
//mov.read();
println("this is the inner loop " + i+" this is gifs[i] " + gifs[i]);
// m.read();
}
stop();
}
void movieEvent(Movie mov) {
mov.read();
}
1