# How Do I Calculate the Bandwidth Required for My Image Acquisition?

Updated Nov 19, 2020

## Environment

### Hardware

• Sony Camera
• Starter Kit for ISC-178x Smart Cameras
• Basler 1394 Camera

### Driver

• IMAQ Vision
I am acquiring an image and need to know the bandwidth required.  How do I calculate the bytes per second of my acquisition?
When it comes to determining the required bandwidth for an acquisition, there are two different data rates we are concerned with finding, the instantaneous and average data rates. Descriptions of these two rates, as well as instructions for their calculation are found in the two sections below.  An example of the calculations is included at the end of the article.

Instantaneous Data Rate

The instantaneous data rate is the most important rate to consider. The instantaneous data rate is the speed at which the camera is streaming data to the frame grabber and is hardware set by the camera's pixel clock rate. If the instantaneous data rate is too high, the frame grabber will not be able to transfer the data across the bus fast enough to empty the buffer and we will experience a buffer overflow error.

To calculate the instantaneous data rate, we need to know three pieces of information:
• The pixel depth (bytes/pixel)*
• The pixel clock rate of the camera (in MHz)
• The number of taps
*10 & 12 bit images are represented as 16 bit in memory.

Use the following equation to calculate the instantaneous data rate:

Instantaneous Data Rate (MB/s) = Pixel Clock Rate (MHz) x Pixel Depth (Bytes) x # of Taps

Once we know the instantaneous data rate, we can then determine if our hardware can handle the acquisition. If the throughput from the frame grabber over the bus is larger than the instantaneous data rate, we will not experience any buffer overflows.

If the throughput is less than the instantaneous data rate, then we have to consider the rate at with the onboard FIFO will fill. If the FIFO fills up before a complete frame is acquired, we will experience a buffer overflow, even if we are only acquiring one frame.

Use the following equation to calculate the FIFO accumulation rate:

FIFO Accumulation Rate (MB/s) = Instantaneous Data Rate - Bus Throughput

We also need to know the amount of time required to acquire one frame from the camera. This number is different from the frame rate and is determined by the camera’s clock rate.

Frame Time (s/frame) = Resolution / (# of Taps x Pixel Clock Rate)

We can use the FIFO accumulation rate and the frame time to determine the FIFO requirement for one frame.

FIFO Requirement = FIFO Accumulation Rate x Frame Time

Average Data Rate

The average data rate is the speed at which the software receives an entire frame from the camera, and is determined programmatically by the frame rate. If a frame is too large to transfer all of the data across the bus in the allotted acquisition time, we will experience an acquisition timeout error.

To calculate the average data rate, you need to know three pieces of information:
• The resolution of the image (also referred to as megapixels)
• The pixel depth (bytes/pixel)
• The frame rate (Hz)
Follow these steps to calculate the bits per second for your acquisition.
1. Width x Height = Resolution (in pixels)
2. Resolution x Pixel Depth = Bytes/frame
3. Bytes/frame x Frame Rate = Bytes/second
Note: This number should be around 10^6 in magnitude, or Megabytes/second.

Example

I am acquiring a 1280x1024 12-bit image at 10 frames per second using a PCIe-1427 frame grabber. My camera has a clock rate of 80 MHz and the board is in a 1x PCIe slot. I am using a 2-tap configuration.  Can I successfully perform a snap acquisition?

Note: The PCIe-1427 has 16 KB of on-board memory. A 1x PCIe slot has a maximum throughput of 200 MB/s.

1. Calculate the instantaneous data rate.

80M pulses/s x 2 pixels/pulse x 2 Bytes/pixel = 320 MB/s
Since 320 MB/s > 200 MBs then we will begin filling the on-board FIFO.

1. Calculate the FIFO accumulation rate.

320 MB/s – 200 MB/s = 120 MB/s

1. Calculate the Frame Time

(1280 pixels/line x 1024lines/frame) / (2 pixels/pulse x 80 pulses/s) = 8.2e-3 s/frame

1. Calculate the FIFO Requirement.

120 MB/s x 8.2e-3 s/frame = 984 KB/frame

Since the FIFO required for one frame is greater than the on-board memory (984 KB > 16 KB) we will experience a buffer overflow error during this acquisition.