Sobel filter
ThexFSobel
function Computes the gradients of input image in both x and y direction by convolving the kernel with input image being processed.
- For Kernel size 3x3
- GradientX:
- GradientY:
- GradientX:
- For Kernel size 5x5
- GradientX:
- GradientY:
- GradientX:
- For Kernel size 7x7
- GradientX:
- GradientY:
- GradientX:
API Syntax
template void xFSobel(xF::Mat & _src_mat,xF::Mat & _dst_matx,xF::Mat & _dst_maty)
Parameter Descriptions
The following table describes the template and the function parameters.
Parameter | Description |
---|---|
FILTER_TYPE | Filter size. Filter size of 3(XF_FILTER_3X3), 5(XF_FILTER_5X5) and 7(XF_FILTER_7X7) are supported |
BORDER_TYPE | Border Type supported is XF_BORDER_CONSTANT |
SRC_T | Input pixel type. Only 8-bit, unsigned, 1 channel is supported (XF_8UC1) |
DST_T | Output pixel type. Only 16-bit, signed, 1 channel is supported (XF_16SC1) for filter size 3 and 5. Only 32 bit, signed 1 channel is supported for filter size 7. |
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; possible options are XF_NPPC1 and XF_NPPC8 for 1 pixel and 8 pixel operations respectively. |
_src_mat | Input image |
_dst_matx | X gradient output image. |
_dst_maty | Y gradient 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.
Operating Mode | Filter Size | Operating Frequency (MHz) |
Utilization Estimate | ||||
---|---|---|---|---|---|---|---|
BRAM_18K | DSP_48Es | FF | LUT | CLB |
|||
1pixel | 3x3 | 300 | 3 | 0 | 609 | 616 | 135 |
5x5 | 300 | 5 | 0 | 1133 | 1499 | 308 | |
7x7 | 300 | 7 | 0 | 2658 | 3334 | 632 | |
8pixel | 3x3 | 150 | 6 | 0 | 1159 | 1892 | 341 |
5x5 | 150 | 10 | 0 | 3024 | 5801 | 999 |
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.
Operating Mode | Operating Frequency (MHz) |
Filter Size | Latency Estimate (in ms) |
---|---|---|---|
1pixel | 300 | 3x3 | 7.5 |
300 | 5x5 | 7.5 | |
300 | 7x7 | 7.5 | |
8pixel | 150 | 3x3 | 1.7 |
150 | 5x5 | 1.71 |