View Full Version : How to detect if no camera singal.

December 21, 2005, 02:54:51
Hi Stefan,

I am using the IC imagingcontrol in vb.net for my application. But how do i know if lost communication with the camera?

The test code is:
Private Sub IcImagingControl1_ImageAvailable(ByVal sender As Object, ByVal e As TIS.Imaging.ICImagingControl.ImageAvailableEventAr gs) Handles IcImagingControl1.ImageAvailable
Dim CurrentBuffer As TIS.Imaging.ImageBuffer

CurrentBuffer = IcImagingControl1.ImageBuffers(e.bufferIndex)
IcImagingControl1.DisplayImageBuffer(CurrentBuffer )

Catch ex As Exception
End Try
End Sub

if i take out the camera cable, the ImageAvailable event is still fired.

Any mistake in my code?

Thanks in advance.


Stefan Geissler
December 21, 2005, 09:11:52

If a video capture device is lost, the driver of the device should notice Windows. Then IC Imaging Control fires the DeviceLost event. (http://www.imagingcontrol.com/ic/docs/html/dotnet/event_descICImagingControl_DeviceLost.htm)

If the ImageAvailable event is fired even if there no device connected, then there must be a problem in the camera driver. What is the contents of the images? What camera do you use?

December 21, 2005, 15:30:43
Hi stefan,

Thanks for your reply. I am using DFG/MC4e Imaging source frame grabber card purchased from your company.

I didn't take out the capture card, but unplugged camera cable. Any way to detect it??


Stefan Geissler
December 21, 2005, 15:49:32
Hello zihui,

if the SignalDetected (http://www.imagingcontrol.com/ic/docs/html/dotnet/prop_descICImagingControl_SignalDetected.htm) property is available (http://www.imagingcontrol.com/ic/docs/html/dotnet/prop_descICImagingControl_SignalDetectedAvailable. htm) then you can use this property.
If it is not available, then you may check in the imageavailable event, wether a small area if the image is changing. The cameras normal produce some noise, even if it is small, the pixels change from one image to the next. If they do not change, then you have to much light (all white) or it is too dark (black) or the camera is not longer connected.
So check on two or more frames some pixels. I think 10 pixels should be enough. If they do not change over these frames, then you can conclude, that the camera has gone.

December 22, 2005, 02:56:19
Hi Stefan,

Thanks for your pointing. It works.

December 22, 2005, 07:25:35
Hi Stefan,

Another question: how to record/buffer a 10 seconds video data continuously using the Imaging Source Library? This 10 seconds video clip can be saved into a file (.avi) with certain condition later.


Stefan Geissler
December 22, 2005, 09:37:39

This is a problem class of its own. You may record samples in the ringbuffer for 10 seconds. The ringbuffer size is 10 * frame rate, e.g. 10 * 15 = 150 frames. You could capture the frames by a call to MemorySnapImageSequence:
ICImagingControl.MemorySnapImageSequence (150).
(http://www.imagingcontrol.com/ic/docs/html/dotnet/meth_descICImagingControl_MemorySnapImageSequence. htm)

With this you have all the frames in memory. But then the problem is to save them into an AVI file later, because IC Imaging Control has no functionallity to save them into an AVI file.

The other, much more simple way is to start AVI capture and stop it after 10 seconds. You could setup a timer for this. The timer is enabled just aver AVICaptureStart returns.
http://www.imagingcontrol.com/ic/docs/html/dotnet/meth_descICImagingControl_AviStopCapture.htm )

December 22, 2005, 10:55:41
Hi Stefan,

Thanks for your prompt reply. I will try the simple way.

Another problem: Is it able to draw a thick line using ".DrawLine" on the overlaybitmap?

Best Regards

Stefan Geissler
December 22, 2005, 11:53:25

Line thickness is not available as parameter. I suggest to draw some more lines in sequence, so you get one thick line.

December 22, 2005, 14:35:12
thanks a lot.

Best Regards