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.
Page Index Toggle Pages: 1
Camera error (Read 1061 times)
Camera error
May 23rd, 2005, 2:12pm
 
It happens randomly but quite often that the camera crash somehow, and I receive this error as output:

Code:
Disabling captureEvent() for null because of an error.
Disabling captureEvent() for null because of an error.

java.lang.reflect.InvocationTargetException


it happens in my both machines with the 0090 version.

What I do inside the captureEvent is that I play with pixels.. like:

Code:
for(int i=0; i<npixels; i++){
img[i]=myCapture.pixels[i];
}


and it seems is that.. so how can I be sure, before working with pixels that the camera is really ready to be read?

thx, chr

Re: Camera error
Reply #1 - May 23rd, 2005, 4:37pm
 
I saw that Robert of flight404 uses capture.available() to check in the draw if there is a new frame, I saw others use different methods. Is there a bug proof one? Smiley

Now I'm trying to test on it.


chr
Re: Camera error
Reply #2 - May 23rd, 2005, 4:47pm
 
I split the captureEvent handler with the code where I analize the frame and it seems it works... something like:

Code:
void captureEvent(Capture myCapture) {
myCapture.read();
newFrame = true;
}


and in the draw:

Code:
void draw(){
if(newFrame){
getFrame();
}
newFrame=false;
}


cya, chr

Re: Camera error
Reply #3 - May 23rd, 2005, 11:35pm
 
you'll get this if there's an error inside your cameraEvent() function. so for instance, if you're walking off the edge of the pixels[] array and it would throw an ArrayIndexOutOfBoundsException, this is what you would see.

(edit) i'm making a note to see if in the regular libs we can do a better job of handling this.
Page Index Toggle Pages: 1