The extractChannel function splits a multi-channel array (32-bit
pixel-interleaved data) into several single-channel arrays and returns a
single channel. The channel to be extracted is specified by using the
channel argument.
The value of the channel argument is specified by macros defined in the
xf_channel_extract_e enumerated data type. The following table
summarizes the possible values for the xf_channel_extract_e
enumerated data type:
| Channel | Enumerated Type |
|---|---|
| Unknown | XF_EXTRACT_CH_0 |
| Unknown | XF_EXTRACT_CH_1 |
| Unknown | XF_EXTRACT_CH_2 |
| Unknown | XF_EXTRACT_CH_3 |
| RED | XF_EXTRACT_CH_R |
| GREEN | XF_EXTRACT_CH_G |
| BLUE | XF_EXTRACT_CH_B |
| ALPHA | XF_EXTRACT_CH_A |
| LUMA | XF_EXTRACT_CH_Y |
| Cb/U | XF_EXTRACT_CH_U |
| Cr/V/Value | XF_EXTRACT_CH_V |
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 extractChannel(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, uint16_t _channel)
Parameter Descriptions
The following table describes the template and the function parameters.
| Paramete r | Description |
|---|---|
| SRC_T | Input pixel type. XF_8UC3, XF_8UC4, XF_16UC3, XF_16UC4. |
| DST_T | Output pixel type. XF_8UC3, XF_16UC3 are supported |
| ROWS | Maximum height of input and output image |
| COLS | Maximum width of input and output image. Must be multiple of 8 for 8 pixel mode |
| NPC | Number of pixels to be processed per cycle; possible options are XF_NPPC1,XF_NPPC2,XF_NPPC4 and XF_NPPC8. |
| XFCVDEPTH_IN_1 | Depth of input image |
| XFCVDEPTH_OUT_1 | Depth of output image |
| _src_ma t | Input multi-channel image |
| _dst_ma t | Output single channel image |
| _channe l | Channel to be extracted (See xf_channel_extract_e enumerated type in file xf_params.h for possible values.) |
Resource Utilization
The following table summarizes the resource utilization of the extractChannel function, generated using Vivado HLS 2019.1 tool for the Xczu9eg-ffvb1156-1-i-es1 FPGA, to process a 4 channel HD (1080x1920) image.
| Operating Mode | Operating Frequency (MHz) | Utilization Estimate | ||||
|---|---|---|---|---|---|---|
| BRAM_18K | DSP_48Es | FF | LUT | CLB | ||
| 1 Pixel | 300 | 0 | 8 | 508 | 354 | 96 |
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 4 channel HD (1080x1920) image.
| Operating Mode | Latency Estimate |
|---|---|
| Max Latency (ms) | |
| 1 pixel operation (300 MHz) | 6.92 |