The convertTo
function converts the input image bit depth to the
required bit depth in the output image.
API Syntax
template <int SRC_T, int DST_T, int ROWS, int COLS, int NPC=1, int XFCVDEPTH_IN_1 = _XFCVDEPTH_DEFAULT, int XFCVDEPTH_OUT_1 = _XFCVDEPTH_DEFAULT>
void convertTo(xf::cv::Mat<SRC_T, ROWS, COLS, NPC, XFCVDEPTH_IN_1> &_src_mat, xf::cv::Mat<DST_T, ROWS, COLS, NPC, XFCVDEPTH_OUT_1> &_dst_mat, ap_uint<4> _convert_type, int _shift)
Parameter Descriptions
The following table describes the template and the function parameters.
Parameter | Description |
---|---|
SRC_T | Input pixel type. 8-bit, unsigned, 1 channel (XF_8UC1), 16-bit, unsigned, 1 channel (XF_16UC1), 16-bit, signed, 1 channel (XF_16SC1), 32-bit, signed, 1 channel (XF_32SC1) are supported. |
DST_T | Output pixel type. 8-bit, unsigned, 1 channel (XF_8UC1), 16-bit, unsigned, 1 channel (XF_16UC1), 16-bit, signed, 1 channel (XF_16SC1), 32-bit, signed, 1 channel (XF_32SC1) are supported. |
ROWS | Height of input and output images |
COLS | Width of input and output images |
NPC | Number of pixels to be processed per cycle; possible options are XF_NPPC1 and XF_NPPC8 for 1 pixel and 8 pixel operations respectively. XF_NPPC8 is not supported with the 32-bit input and output pixel type. |
XFCVDEPTH_IN_1 | Depth of input image |
XFCVDEPTH_OUT_1 | Depth of output image |
_src_mat | Input image |
_dst_mat | Output image |
_convert_ty pe | This parameter specifies the type of conversion required. (See XF_convert_bit_depth_e enumerated type in file xf_params.h for possible values.) |
_shift | Optional scale factor |
Possible Conversions
The following table summarizes supported conversions. The rows are possible input image bit depths and the columns are corresponding possible output image bit depths (U=unsigned, S=signed).
INPUT/OUTPUT | U8 | U16 | S16 | U32 | S32 |
---|---|---|---|---|---|
U8 | NA | yes | yes | NA | yes |
U16 | yes | NA | NA | NA | yes |
S16 | yes | NA | NA | NA | yes |
U32 | NA | NA | NA | NA | NA |
S32 | yes | yes | yes | NA | NA |
Resource Utilization
The following table summarizes the resource utilization of the convertTo function, generated using Vivado HLS 2019.1 tool for the Xilinx® Xczu9eg-ffvb1156-1-i-es1 FPGA, to process a grayscale HD (1080x1920) image.
Operating Mode | Operating Frequency (MHz) | Utilization Estimate | ||||
---|---|---|---|---|---|---|
BRAM_18K | DSP_48Es | FF | LUT | CLB | ||
1 Pixel | 300 | 0 | 8 | 581 | 523 | 119 |
8 Pixel | 150 | 0 | 8 | 963 | 1446 | 290 |
Operating Mode | Operating Frequency (MHz) | Utilization Estimate | ||||
---|---|---|---|---|---|---|
BRAM_18K | DSP_48Es | FF | LUT | CLB | ||
1 Pixel | 300 | 0 | 8 | 591 | 541 | 124 |
8 Pixel | 150 | 0 | 8 | 915 | 1500 | 308 |
Performance Estimate
The following table summarizes the performance in different configurations, as generated using Vivado HLS 2019.1 tool for the Xczu9eg-ffvb1156-1-i-es1, to process a grayscale HD (1080x1920) image.
Operating Mode | Latency Estimate |
---|---|
Max Latency (ms) | |
1 pixel operation (300 MHz) | 6.9 |
8 pixel operation (150 MHz) | 1.69 |