If a camera is unplugged, the VideoGrabber replaces the camera image with a warning message that the camera is unplugged. I would like to either
- replace the image with my own image
- set a flag on the videoGrabber that signals the camera is unplugged.
I am unable to find where in the code the warning message is inserted. Can anyone point me in the right direction?
I don’t know if this is much help, but since there are no other replies maybe I can offer some suggestions…
First of all I tried recreating this error on 0.06 on OS X, using the video grabber example. When I unplug my camera the program just crashes, I don’t get this error image, so I assume you’re on either Windows or Linux??
The only thing I can think of if you aren’t getting any error message is that the image is coming from the OS. Since you can use the isFrameNew() bool with vidgrabber, maybe you can setup a counter that resets every time a new frame is found…and if the frame isn’t new replace the image with an error message/image. I am not sure if this would work (if the image is coming from the OS than maybe the frame will be new…) but it might be worth a shot?
The ideal situation would be finding a way to see if the OS is sending an error message, but i’m not sure how you’d do that or what OS you’re on.
Hope that maybe helps?
This almost certainly coming from your OS or from the camera driver.
Here’s a really easy hack: save a copy of the image and do a comparison on every frame For legitimate frames this should be a very inexpensive operation, as you know within a few pixels that it’s not the warning image.
ah yea thats a good solution, probably only have to check 1 pixel every frame, super smart!