Okay, so apparently my pixel array is 76800 (which makes sense (width*height = 320*240).
Which, still leaves me confused as to why the array is going out of bounds.
Treating the video as a texture and using beginShape(QUADS) works, but seems to run slower than just using myMovie.get and grabbing and then displaying a single line that way.
The real key for me however, is the fact that I would like to be able to get more than just "straight" lines. I would like to be able to draw a line myself on the screen, and then have the pixel coordinates of the line stored and then use those same coordinates to display the "video line". Basically just another form of slit scan imaging, but with the "slit" capable of taking on a user-defined shape.
Anyway, here is the full code:
Quote:
import processing.video.*;
Movie myMovie;
int y;
int[] hLine = new int[76800];
final int xOffset = 100;
final int movieWidth = 320;
void setup()
{
size(1200, 240);
myMovie = new Movie(this, "Escalator.mov");
myMovie.play();
}
void draw()
{
if(myMovie.available()) {
myMovie.read();
}
loadPixels();
for(y = 0; y < height; y++) {
hLine[y] = myMovie.pixels[(movieWidth * y) + xOffset];
}
for (int i=0; i<height; i++) {
pixels[i] = hLine[i];
}
updatePixels();
}
void movieEvent(Movie m) {
m.read();
}
I am, as I mentioned, quite certain that the method I am using to draw the pixels to screen is incorrect, but it is still hanging up at the same place:
Quote:
for(y = 0; y < height; y++) {
hLine[y] = myMovie.pixels[(movieWidth * y) + xOffset];
}
Where I get the error message:
java.lang.ArrayIndexOutOfBoundsException: 100
at Temporary_9883_5945.draw(Temporary_9883_5945.java:25)
at processing.core.PApplet.handleDisplay(PApplet.java:1355)
at processing.core.PGraphics.requestDisplay(PGraphics.java:564)
at processing.core.PApplet.run(PApplet.java:1450)
at java.lang.Thread.run(Thread.java:613)
Any thoughts?
And again, thanks for the help.