IC Imaging Control .NET

ICImagingControl.LivePrepare Method

ICImagingControl.LivePrepare Method

This method tries to setup the image stream by connecting the device with the display and the sink and inserting frame filters and overlays.
Syntax:
[VB.NET]
Public Sub LivePrepare()
[C#]
Public void LivePrepare();
Return Value:

If the image stream could not have been prepared, an exception is thrown.

Remarks:

LivePrepare prepares the image stream but does not start the live video and also does not allocate bandwidth on the used bus (FireWire or USB). Therefore this method is suitable in an environment with more than one video capture device. Subsequent starts of the live video by a call to LiveStart are much faster than LiveStart without a previous LivePrepare call.

A prepared and started live stream can be stopped and switched back to prepared state by a call to LiveSuspend.

A call to LiveStop clears the prepared live stream.

No operations which may change the layout of the video stream are permitted after LivePrepare was called. These operations are:

Information:

Introduced in version 3.1

Sample:

This example shows to use some IC Imaging Controls in an array and open some video capture devices. The image streams are prepared right after the video capture devices have been opened.

In a simulated processing loop MemorySnapImage is executed in sequence on each IC Imaging Control. This loop runs relatively fast, because the live streams for each video capture have already been prepared.

[VB.NET]
' Create ICImagingControl instances for each connected video capture device. Dim CameraCount As Integer = 2 Dim IC(CameraCount) As TIS.Imaging.ICImagingControl For Camera As Integer = 0 To CameraCount - 1 IC(Camera) = New ICImagingControl() IC(Camera).ShowDeviceSettingsDialog() Try 'Try to prepare the image stream. IC(Camera).LivePrepare() Catch Ex As ICException MessageBox.Show(Ex.Message) End Try Next ' Now do some processing, e.g. snap an image. This loop simulates ' 10 times image processing for each camera in sequence. For i As Integer = 0 To 10 For Camera As Integer = 0 To CameraCount - 1 If IC(Camera).IsLivePrepared = True Then Try ' Use a timeout of 1000ms. IC(Camera).MemorySnapImage(1000) ' Show the snapped image in a PictureBox. PictureBox1.Image = IC(Camera).ImageActiveBuffer.Bitmap PictureBox1.Update() Catch Ex As ICException MessageBox.Show(Ex.Message) End Try End If Next Next ' At the end of the application the prepared live video streams should be stopped. For Camera As Integer = 0 To CameraCount - 1 IC(Camera).LiveStop() Next
[C#]
// Create ICImagingControl instances for each connected video capture device. int CameraCount = 2; TIS.Imaging.ICImagingControl[] IC = new ICImagingControl[CameraCount]; // Open the video capture devices and prepare the live video stream for (int Camera = 0; Camera < CameraCount; Camera++) { IC[Camera] = new ICImagingControl(); IC[Camera].ShowDeviceSettingsDialog(); try { // Try to prepare the image stream. IC[Camera].LivePrepare(); } catch (ICException Ex) { MessageBox.Show(Ex.Message, "LivePrepare Error"); } } // Now do some processing, e.g. snap an image. This loop simulates // 10 times image processing for each camera in sequence. for (int i = 0; i < 10; i++) { for (int Camera = 0; Camera < CameraCount; Camera++) { if (IC[Camera].IsLivePrepared) { try { IC[Camera].MemorySnapImage(1000); // Show the snapped image in a PictureBox. pictureBox1.Image = IC[Camera].ImageActiveBuffer.Bitmap; pictureBox1.Update(); } catch (ICException Ex) { MessageBox.Show(Ex.Message, "MemorySnapImage Error"); } } } } // At the end of the application the prepared live video streams should be stopped. for (int Camera = 0; Camera < CameraCount; Camera++) { IC[Camera].LiveStop(); }
See also: ICImagingControl, ICImagingControl.LiveSuspend, ICImagingControl.LiveStart, ICImagingControl.LiveStop, ICImagingControl.LiveVideoRunning, ICImagingControl.IsLivePrepared

<< ICImagingControl

Get in touch with us


About The Imaging Source

Established in 1990, The Imaging Source is one of the leading manufacturers of industrial cameras, frame grabbers and video converters for production automation, quality assurance, logistics, medicine, science and security.

Our comprehensive range of cameras with USB 3.1, USB 3.0, USB 2.0, GigE interfaces and other innovative machine vision products are renowned for their high quality and ability to meet the performance requirements of demanding applications.

Automated Imaging Association ISO 9001:2015 certified

Contact us