Thresholding

ThexFThresholdfunction performs thresholding operation on the input image. Thresholding are of two types, binary and range.

In the Binary thresholding, the threshold value will be set and the depending upon the threshold value the output is set to either 0 or 255. The _binary_thresh_val has to be set to the threshold value when the binary thresholding is selected, as well as the _upper_range and _lower_range has to be set to 0.

In the Range thresholding, the upper and the lower threshold values are set and depending upon those values the output is set either 0 or 255. The _upper_range and _lower_range values has to be set to the upper and the lower threshold values respectively, when the range thresholding is selected, as well as in this case the _binary_thresh_val has to be set to 0.

API Syntax

template void xFThreshold(xF::Mat & _src_mat,xF::Mat & _dst_mat,short thresh_val,short thresh_upper,short thresh_lower)

Parameter Descriptions

The following table describes the template and the function parameters.

Table 1.xFThreshold Function Parameter Descriptions
Parameter Description
THRESHOLD_TYPE Type of thresholding. It can be either binary thresholding or range thresholding. Options are XF_THRESHOLD_TYPE_BINARY or XF_THRESHOLD_TYPE_RANGE.
SRC_T Input pixel type. Only 8-bit, unsigned, 1 channel is supported (XF_8UC1)
ROWS Maximum height of input and output image (must be a multiple of 8)
COLS Maximum width of input and output image (must be a multiple of 8)
NPC Number of pixels to be processed per cycle; this function supports only XF_NPPC1 or 1 pixel per cycle operations.
_src_mat Input image
_dst_mat Output image

Resource Utilization

The following table summarizes the resource utilization of the kernel in different configurations, generated usingVivado HLS 2017.1tool for the Xilinx Xczu9eg-ffvb1156-1-i-es1 FPGA, to process a grayscale HD (1080x1920) image.

Table 2.xFThreshold Function Resource Utilization Summary
c Resource Utilization
1 pixel 8 pixel
300 MHz 150MHz
BRAM_18K 0 0
DSP48E 3 3
FF 410 469
LUT 277 443
CLB 72 103

Performance Estimate

The following table summarizes the performance of the kernel in different configurations, as generated usingVivado HLS 2017.1tool for the Xilinx Xczu9eg-ffvb1156-1-i-es1, to process a grayscale HD (1080x1920) image.

Table 3.xFThreshold Function Performance Estimate Summary
Operating Mode

Operating Frequency

(MHz)

Latency Estimate

(ms)

1pixel 300 7.2
8pixel 150 1.7