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:

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:

Dim FirstBuffer As ImageBuffer

FirstBuffer = ICImagingControl1.ImageBuffers(1)

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