I'm attempting to read a segment of video from a file in the data directory, store individual frames in an array and display these frames in a picture viewer that mimics Itunes coverflow. I've been able to load the array in a sequential fashion by reading and storing each frame as the sketch cycles through the draw() method. In fact, a previous iteration is able to display the frames, offsetting them on the x axis by ten. This iteration of the sketch doesn't want to display the images to the screen and I know it has something to do with how OPENGL or P3D renders the image to the screen.
I've used some of the code in this sketch which does exactly what I want to do but with a sequence of frames from a sample of a movie.
http://www.openprocessing.org/sketch/10451
This should work with any sample video. I've been using the infamous cat clip, and also another sample from a movie. here's the code:
import processing.video.*;
int maxImages = 35;
int router = 1;
int r=1;
Movie movie;
int ii = 0;
int iii = 0;
PImage[] gifs = new PImage[maxImages];
//these are all of the variables we need to run PhotoView
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]);
I suspected .pngs made from photoshop brushes would look good when emitted from something like a particle emitter. Playing with the demo included in the ani library resulted in this short video.
I've got what might be a simple question with an obvious answer I may have overlooked. I'm attempting to write a text file to the data directory. However, instead of the data directory, the text file is being written to the program's directory.
How do I specify the particular directory to which I wish to write the text file?