Scharr Filter

ThexFScharrfunction 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:

API Syntax

template void xFScharr(xF::Mat & _src_mat,xF::Mat & _dst_matx,xF::Mat & _dst_maty)

Parameter Descriptions

The following table describes the template and the function parameters.

Table 1.xFScharr Function Parameter Descriptions
Parameter Description
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)
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.

Table 2.xFScharr Function Resource Utilization Summary
Name Resource Utilization
1 pixel 8 pixel
300 MHz 150MHz
BRAM_18K 3 6
DSP48E 0 0
FF 728 1434
LUT 812 2481
CLB 171 461

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.xFScharr Function Performance Estimate Summary
Operating Mode

Operating Frequency

(MHz)

Latency Estimate

(ms)

1pixel 300 7.2
8pixel 150 1.7