For my class, I'm analyzing the pixels in an image and storing the coordinates of any pixel that surpasses a particular brightness threshold. I kept getting the "array index out of bounds" error, which had something to do with the number 1031 (which happens to be the dimensions of my image-- 1031x1031). I've since changed the code so my arrays are
< img.length or
img.width, but now it seems that it isn't analyzing the entire image (I make this conclusion because the ellipses I draw around these points only cover 1/4 of the image).
What I want to do:analyze the image and
store the x,y location of any points that are >= a given brightness threshold
into a set of arrays so that I may recall these points to be used in a series of lines or vertices in the beginShape()/endShape() function.
I have been working on this slideshow for a while. I've solved all of my previous errors, if anyone has been keeping track. Now I have my entire slideshow, but I can't figure out how to loop it continuously. To be more explicit, once my sketch has reached the 3060th image (or 3060th frame, as I have it coded right now), how do I make it start from the beginning? I only want my slideshow to stop when I press escape (once it has been exported as an application).
How do I generate a random set of integers for an array (which determines endpoints for various lines) ONCE, and then when keyPressed, I can regenerate a new set of random integers?
I've created a function called LinearDeformation, and through a series of calculations I determine the endpoints for "major segments" which have a certain X range and Y range according to the width and height of the display. The random function determines a point within the determined ranges.
At the moment, the random function is continuously looping. I don't want to use noLoop(); because I want to be able to adjust the "margChange" continuously by pressing the arrow keys (and have real-time feedback). I've tried creating a separate function for integer generation but I'm having trouble figuring out how to structure it.
I've created a small image array and I'm trying to experiment with exporting the sketch to a .mov where I can later use it in iMovie.
I read this thread and tried implementing the advice from there into my own code. However, I'm running into trouble and can't actually export anything (error message below).
If it is important, I'm using Processing 1.5.1 on a mac laptop, and I don't have the moviemaker option under Tools.
Here is the code:
import processing.video.*;
MovieMaker mm;
/////// MOVIE CODE
int numFrames = 12;
PImage[] images = new PImage[numFrames];
void setup() {
size(1440, 900);
///////
mm = new MovieMaker(this,width,height,"NOZOOM_PUBLIC_MONEY_3.mov", 30, MovieMaker.JPEG, MovieMaker.HIGH);
///////
frameRate(4);
for (int i = 0; i < 12; i++) {
String imageName = "A" + i +"_8.jpg";
images[i] = loadImage(imageName);
}}
void draw() {
int frame = frameCount % 12;
image(images[frame], 0, 0);
println(frame);
mm.addFrame();
}
void keyPressed() { //MOVIEMAKER
if (key == ' ') { //MOVIEMAKER
// Finish the movie if space bar is pressed //MOVIEMAKER
mm.finish(); //MOVIEMAKER
// Quit running the sketch once the file is written //MOVIEMAKER