I have problems with my processing memory. I already increased the memory in the settings to 5000MB, so I guess there's a bug in my code.
In the code every second a image of the webcam is saved, 360 images in total. (After 360 images it starts with image1 again). Till then the code works fine, it can run forever.
The problems start here:
By pressing 'a' or 'd', the 'old' images are loaded on the stage as small images, arranged to a circle around the webcam. (Have a look at the screenshot)
By using the keys 'a' and 'd', the code runs for about 20 seconds. After 20 seconds I get the "Out-of-Memory-Error".
I guess I have to remove the old images before I load a new one at the same prosition? But how? Can anyone help me?
You can find the code below the screenshot.
Attention: If you try this code, you have to run it for 6 mins before you can use 'a' and 'd'. It needs 6 mins to save all the 360 images in the data-folder.
I hope anyone can help. I tried to solve this problems for some nights already... Thanks!! :)
import processing.video.*;
int reality = 1; //image number of live image
int memory = 1; //image number of images of the past
int output = 1; //image which is shown then. It's a "reality-correction" of memory.
int outputSafe = 1; //Always between 1 and 360
boolean timeJorney = false;
boolean keyPressing = false;
Capture cam;
if (cameras.length == 0) {
println("There are no cameras available for capture.");
exit();
} else {
//println("Available cameras:");
for (int i = 0; i < cameras.length; i++) {
// println(cameras[i]);
}
// The camera can be initialized directly using an
// element from the array returned by list():
cam = new Capture(this, cameras[0]);
imageMode(CENTER);
cam.start();
}
}