We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › I NEED HELP PLEASE!
Page Index Toggle Pages: 1
I NEED HELP PLEASE! (Read 683 times)
I NEED HELP PLEASE!
Mar 22nd, 2007, 2:10am
 
Okay...so I'm in a "programming for artists" type class and I need help with my program. The basic idea of the program is to display an array of gifs over a video that I made in Final Cut. The array is thirty images, each just a black image with a transperant hole cut in them, and are about 4 kbs each. Everytime I try to run the program it displays like 4 or 5 of them and then displays an error that reads:

"Exception in thread "Thread-2" java.lang.OutOfMemoryError: Java heap space"

I'm not sure what's wrong with the code but if anyone could give me any kind of help I'd greatly appreciate it. Here's the code:



import processing.video.*;

Movie doorMovie;
Mask doorMask;

void setup() {
 size(720, 480);
 doorMask = new Mask("Mask", 29); //the masks created to cover the video, 30 of them
 doorMovie = new Movie(this, "The Door.mov"); //the video of a dolly up to a door
 doorMovie.loop();
 frameRate(2);
}

void draw() {  
 image(doorMovie, 0, 0);
 doorMask.display();
}

// Called every time a new frame is available to read
void movieEvent(Movie m) {
 m.read();
}


class Mask
{
 PImage[] degrade;
 int frame;
 int numFrames;

 Mask(String imageName, int frameCount) {
   numFrames = frameCount;
   degrade = new PImage[numFrames];
   loadImages(imageName);
 }

 void loadImages(String name) {
   for(int i=0; i<numFrames; i++) {
     String imageName = name + ((i < 10) ? "0" : "") + i + ".gif";
     degrade[i] = loadImage(imageName);
   }
 }

 void display(){
   int framenum = int(random(numFrames));
   println(framenum);
   image(degrade[framenum], 0, 0);
 }
}  


The idea seemed simple enough...so I figured the code would be too but it's not working. Again, if anyone could give me any kind of help I'd greatly appreciate it.
Re: I NEED HELP PLEASE!
Reply #1 - Mar 22nd, 2007, 5:16pm
 
Processing generally dies when you load a lot of images in. Have you tried just one image repeated? Or you could try not running the Movie. It's bound to be one of the two, find out which.

Plus instead of .gifs I would recommend .pngs. Their transparency is preserved and you'll be able to antialias those holes so the edges don't look so crunchy.
Re: I NEED HELP PLEASE!
Reply #2 - Mar 22nd, 2007, 9:04pm
 
Maybe you're interested in this post.
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1172699941
There is no need to load images for a mask cause you can build the mask in processing using a PGraphics object. Also you're more flexible this way, cause you can move the mask hole by the mouse for example, or change the size of the hole.
Page Index Toggle Pages: 1