The autogain function calculates automatic gain adjustment for an image by analyzing its histogram, grouping bins into clusters, and selecting appropriate gain values for the red, green, and blue channels based on the most populated histogram cluster. The computed gain values (rgain, ggain, bgain) help in adjusting the image brightness and contrast dynamically.
API Syntax
template <int SRC_T, int NPC = 1, int HISTSIZE>
void autogain(unsigned int histogram[XF_CHANNELS(SRC_T, NPC)][HISTSIZE], uint16_t gain[XF_CHANNELS(SRC_T, NPC)])
The following table describes the template and the function parameters.
Parameter | Description |
---|---|
SRC_T | Input Pixel Type. Supported types are XF_8UC3, XF_10UC3, XF_12UC3 and XF_16UC3. |
NPC | Number of Pixels to be processed per cycle. Supports (XF_NPPC1) |
HISTSIZE | Histogram size. Supported values 256, 1024, 4096 |
histogram | Input histogram array |
gain | Output gain array |
Resource Utilization
The following table summarizes the resource utilization of the kernel in 1 pixel configuration, generated using Vivado HLS 2024.2 tool for the Xilinx xcu200-fsgd2104-2-e FPGA, to process Histogram of 4096 bins.
Operating Mode | Operating Frequency (MHz) |
Utilization Estimate | |||
---|---|---|---|---|---|
BRAM_36K | DSP_48Es | FF | LUT | ||
1 pixel | 300 | 0 | 0 | 583 | 766 |
Performance Estimate
The following table summarizes a performance estimate of the kernel in 1 pixel configuration, as generated using Vivado HLS 2024.2 tool for the Xilinx xcu200-fsgd2104-2-e, to process Histogram of 4096 bins.
Operating Mode Operating Frequency
(MHz)
Latency Estimate Max (ms) 1 pixel 300 0.01839