The Threshold function performs thresholding operation on the input
image. There are several types of thresholding supported by the
function.
API Syntax
template<int THRESHOLD_TYPE, int SRC_T, int ROWS, int COLS,int NPC=1, int XFCVDEPTH_IN = _XFCVDEPTH_DEFAULT, int XFCVDEPTH_OUT = _XFCVDEPTH_DEFAULT>
void Threshold(xf::cv::Mat<SRC_T, ROWS, COLS, NPC, XFCVDEPTH_IN> & _src_mat,xf::cv::Mat<SRC_T, ROWS, COLS, NPC, XFCVDEPTH_OUT> & _dst_mat,short int thresh,short int maxval )
Parameter Descriptions
The following table describes the template and the function parameters.
| Parameter | Description |
|---|---|
| THRESHOLD_TY PE | Type of thresholding. |
| SRC_T | Input pixel type. Only 8-bit, unsigned, 1 channel is supported (XF_8UC1). |
| ROWS | Maximum height of input and output image. |
| COLS | Maximum width of input and output image. Must be multiple of 8, for 8-pixel operation. |
| NPC | Number of pixels to be processed per cycle. |
| XFCVDEPTH_IN | Depth of the input image. |
| XFCVDEPTH_OUT | Depth of the output image. |
| _src_mat | Input image |
| _dst_mat | Output image |
| thresh | Threshold value. |
| maxval | Maximum value to use with the THRESH_BINARY and
THRESH_BINARY_INV thresholding types. |
Resource Utilization
The following table summarizes the resource utilization of the kernel with binary thresholding in different configurations, generated using Vivado HLS 2019.1 tool for the Xilinx Xczu9eg-ffvb1156-1 FPGA, to process a grayscale HD (1080x1920) image.
| Name | Resource Utilization | |
|---|---|---|
| 1 pixel per clock operation | 8 pixel per clock operation | |
| 300 MHz | 150 MHz | |
| BRAM_18K | 0 | 0 |
| DSP48E | 0 | 0 |
| FF | 110 | 154 |
| LUT | 61 | 139 |
| CLB | 16 | 37 |
Performance Estimate
The following table summarizes the performance of the kernel in different configurations, as generated using Vivado HLS 2019.1 tool for the Xilinx Xczu9eg-ffvb1156-1, to process a grayscale HD (1080x1920) image.
| Operating Mode | Operating Frequency (MHz) |
Latency Estimate (ms) |
|---|---|---|
| 1 pixel | 300 | 7.2 |
| 8 pixel | 150 | 1.7 |