IC Imaging Control .NET

Using Multiple Buffers

Using Multiple Buffers

In the previous chapters, IC Imaging Control appeared to work with only one image buffer. In fact, IC Imaging Control uses multiple buffers to store image data. This chapter describes how multiple buffers are organized inside IC Imaging Control and in which way a program can access these buffers. Internally, IC Imaging Control uses a ring buffer to store image data. The next section will describe the idea behind the ring buffer concept.

What is a Ring Buffer

A ring buffer is an array of image buffers, which are accessed in the following way: IC Imaging Control writes the first frame, coming from a video capture device, to the first element of the ring buffer. The second frame is written to the second buffer and so on. As soon as a frame has been written to the last element of the ring buffer, IC Imaging Control writes the next frame to the first buffer, overwriting the image data of the first frame.

This concept has the following benefits:

  • The image from one image buffer can be processed, while incoming image data is being written to another buffer simultaneously.
  • Previously acquired images can be accessed without copying the image data. This is particularly useful, if an image processing function detects an event (e.g. motion detection) in the current image. It is possible to go back the number of frames the image buffer is large, minus 1 frame. In other words, you can look into the past.

How to Access Image Buffers

Index-based access to an image buffer is provided by the ImageBuffers collection. If, for example, you want to access the first buffer, you should use the following code:

[VB.NET]
Dim FirstBuffer As TIS.Imaging.ImageBuffer FirstBuffer = IcImagingControl1.ImageBuffers(0)
[C#]
TIS.Imaging.ImageBuffer FirstBuffer; FirstBuffer = icImagingControl1.ImageBuffers[0];

Locking Buffers

If you want to prevent IC Imaging Control from copying data to a buffer, you have to lock this buffer with a call to ImageBuffer.Lock. You may want to do so, if time intensive image processing is carried out on the buffer. If you do not lock the buffer, IC Imaging Control may overwrite the data in the buffer while you are processing its data.

You have to call ImageBuffer.Unlock to allow IC Imaging Control to copy data to the buffer again.

<< Programmer's Guide

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