I’ve written this code to find the edges in my image which I have named properly in the correct file:
<PImage frog;
void setup(){
size(1200,720);
frog=loadImage(“frog.jpg”);
}
void draw(){
loadPixels();
frog.loadPixels();
for(int x=0; x<width-4; x++){
for(int y=0; y<height; y++){
int loc1=x+y*width;
int loc2=(x+1)*width;
float b1=brightness(frog.pixels[loc1]);
float b2=brightness(frog.pixels[loc2]);
float diff=abs(b1-b2);
pixels[loc1]=color(diff);
}
}
updatePixels();
}
And I keep getting this error:
‘‘ArrayIndexOutOfBoundsException: 864000
Could not run the sketch (Target VM failed to initialize).
For more information, read revisions.txt and Help ? Troubleshooting.’’