IC Imaging Control .NET

ICImagingControl.MemorySnapImage Method

ICImagingControl.MemorySnapImage Method

This method captures a still image from a live video stream.
Syntax:
[VB.NET]
Public Sub MemorySnapImage Public Sub MemorySnapImage( timeoutInMs As Integer )
[C#]
Public void MemorySnapImage(); Public void MemorySnapImage( int timeoutInMs );
Parameter Description
timeoutInMs

Specifies the snap timeout value in milliseconds.

Remarks:

This method captures a still image from a live video stream and stores it in the ring buffer. The buffer can be saved to a file using the ICImagingControl.MemorySaveImage Method.

If the live video stream is already running, then the maximum duration of MemorySnapImage is double of the frame rates time interval. MemorySnapImage captures the next new provided image from the live video stream.

If the live video stream was not started before a call of MemorySnapImage, then the live video stream is started in MemorySnapImage automatically. An image will be captured and the live video stream is stopped automatically. If MemorySnapImage is called often in an application, then this sequence of start - snap - stop can be very time expensive. Thus, it is better to call LiveStart once in the application and stop the live video stream when the application ends.

When LiveCaptureContinuous is true, MemorySnapImage throws an ICException with the error code ICException.ErrorCodes.NotAvailableOutsideSnapMode.

If no image was provided by the video capture device in the timeout time an exception is thrown.

If an external triggered camera is in use, then MemorySnapImage should be avoided, because it blocks the application until it returns. For triggered cameras the ImageAvailable event should be used.

Sample:

The following code snippet shows how to snap an image from the video live stream using a timeout of 1000ms. The snapped image will be shown in a PictureBox:

[VB.NET]
IcImagingControl1.LiveStart() Try ' Use a timeout of 1000ms. IcImagingControl1.MemorySnapImage(1000) ' Show the snapped image in a PictureBox. PictureBox1.Image = IcImagingControl1.ImageActiveBuffer.Bitmap Catch Ex As ICException MessageBox.Show(Ex.Message) End Try IcImagingControl1.LiveStop()
[C#]
ICImagingControl1.LiveStart(); try { // Use a timeout of 1000ms. ICImagingControl1.MemorySnapImage(1000); // Show the snapped image in a PictureBox. pictureBox1.Image = ICImagingControl1.ImageActiveBuffer.Bitmap; } catch (ICException Ex) { MessageBox.Show(Ex.Message, "MemorySnapImage Error"); } ICImagingControl1.LiveStop();
See also: ICImagingControl, ICImagingControl.MemorySaveImage, ICImagingControl.ImageActiveBuffer, ICException.ErrorCodes

<< 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