PDA

View Full Version : how to know that Camera is Disconnected?



abdul_khathar
July 27, 2009, 09:26:02
dear Stefan!

after starting live mode, if i need to check that whether the camera is working perfectly, how to do that?

i tried with sLive() function but its not working.

please let me know. i just need to throw the message from my application that if there is any problem in my camera after starting live mode.

thanks in advance.

AK

Sascha Schmidt
July 28, 2009, 17:44:50
Hallo abdul,

you can use the "GrabberListener::deviceLost" method, in order to detect if the device is lost.

Please have a look at:
http://www.imagingcontrol.com/en_US/support/documentation/class/meth_descGrabberListener_deviceLost.htm

Duduche
January 22, 2010, 12:01:49
Hello,

I am using the Video -> USB converters, and I would like to know if there is a way to be notified if the video cable (and not the device itself) is disconnected or incorrectly inserted?

I checked but the deviceLost method is only called in case the USB cable is disconnected, not if the video signal is disconnected (which makes sense).

From what I tested so far, it looks like when video is disconnected, the wrapper notifies at random frequency some blue/blue and black/black image. I could try to measure the average frequency of notifications to detect the problem but I would be happy if there was an easier way to do it!

Stefan Geissler
January 25, 2010, 09:23:22
Hello,

the DFG/USB2-lt provides images all the time, even if no video signal is connected to the converter.

Thus the only way to check whether there is a valid video signal, is to look for some pixels in the GrabberListener class. If no video device is connected, then the provided images are black or green. The trick is to check an area on the image, whether the pixels in the area have different colors. They must be different, because there is every time some noise. If the pixel colors are all equal, then obviously no video capture device is connected.

A colleague of mine created a frame filter, that does this check.

Duduche
January 27, 2010, 17:23:35
Thank you very much for this sample, I will test it ASAP!

Duduche
February 12, 2010, 09:59:25
It works fine, thanks a lot!

I noticed though, that in case of low exposure some valid images are detected as invalid. To avoid this I changed the tests:

if( Count > 25 && !noDevice)
and

else if ( Count < 25 && noDevice )
in DeviceLostFilter.cpp by

if( Count > 29 && !noDevice)
and

else if ( Count < 29 && noDevice )
It might be helpful depending on your exposure conditions!

Stefan Geissler
February 12, 2010, 12:28:56
Duduche, please keep in mind, this filter is only sense full to be used with the DFG/USB2-lt. For all cameras you can use the DeviceLost event. For the DFG/1394 you can use its "Signal Detected" property.