Acquisition

NI-IMAQdx

Acquisition

After configuring and starting your acquisition, the camera sends data to the internal buffers. To process the acquired image data, you must copy the data from the internal buffer into your user buffer.

User Buffer

Before starting the acquisition, you must allocate a user buffer in addition to configuring internal buffers. The driver copies or decodes image data from the internal buffer into the user buffer during acquisition. Then, process and analyze the image in the user buffer.

When acquiring data into an image, the driver resizes and casts the image as needed. However, if you acquire data into a user buffer, you must allocate enough space for one decoded image.

Note Note  Unlike internal buffers, you are responsible for destroying user buffers.

Internal Buffer

Memory page that is marked as non-pageable by the virtual file system. Internal buffers remain in physical memory and do not cause page faults. They are also known as a page-locked buffer.

Page-Locked Buffers

Memory page that is marked as non-pageable by the virtual file system. Page-locked buffers remain in physical memory and do not cause page faults. Also known as internal buffers.

Buffer Number Mode

Specify one of the following options for the buffer number mode.

  • Buffer number—Gets the exact buffer number specified in the Buffer Number parameter.
  • Next—Gets the next incoming buffer.
  • Last—Gets the most recently acquired buffer.

Buffer Number

Buffer number gets the exact buffer number specified in the buffer number parameter.

A buffer number is a zero-based index that represents the cumulated transferred image count. For example, during a continuous acquisition with three internal buffers, the buffer number is updated as follows: 0, 1, 2, 3, 4, 5, and so on. Buffer numbers 0 and 3 refer to the same internal buffer in the buffer ring.

For a one-shot acquisition, you can request only one of the available buffer numbers. For a continuous acquisition, you can request any present or future buffer number. You can also request the next logical buffer or the buffer containing the most recently acquired data. With high-level grab acquisitions, the buffer number defaults to the next transferred buffer.

When you complete the buffer acquisition step, the driver returns the actual buffer number with the image.

Overwrite Mode

Ideally, a continuous acquisition acquires and processes every image that is transferred from the camera. However, because of processing time fluctuations, some images from the camera may not be processed before the camera transfers the next image. Using multiple internal buffers in a continuous acquisition allows for a small amount of jitter. However, if a delay becomes too long, the camera overwrites the requested buffer with new image data.

Timeout

A timeout is the length of time, in milliseconds, that the driver waits for an image from the camera before returning an error. A timeout error usually occurs if the camera has been removed from the system or when the camera did not receive an external trigger signal.

Decoding

Except for 8-bit monochrome images, all video modes require decoding before you can interpret the image data. For example, many color cameras output images of type YUV 4:2:2. However, NI Vision does not natively support the YUV mode. To process and display the image, the driver automatically decodes the YUV image into a 32-bit RGB image.

The following table lists common video modes and their corresponding image types after being decoded by NI-IMAQdx.

Raw Camera Output Image_U8
8-bit monochrome Image_U8
10–16-bit monochrome Image_I16
YUV 4:1:1 Image_RGB
YUV 4:2:2 Image_RGB
YUV 4:4:4 Image_RGB
24-bit RGB Image_RGB
30–48-bit RGB Image_RGB_U64
8-bit Bayer Image_RGB
10–16-bit Bayer Image_RGB

Decoding images requires CPU resources. However, many of the decoding algorithms have been optimized in the driver. If you do not want decoded image data, you can use NI-IMAQdx to get a copy of the raw camera output.