Gradient Magnitude
ThexFmagnitude
function computes the magnitude for the images. The input images are x-gradient and y-gradient images of type 16S. The output image is of same type as the input image.
For L1NORM normalization, the magnitude computed image is the pixel-wise added image of absolute of x-gradient and y-gradient, as shown below:.
For L2NORM normalization, the magnitude computed image is as follows:
API Syntax
template< int NORM_TYPE ,int SRC_T,int DST_T, int ROWS, int COLS,int NPC=1> void xFmagnitude(xF::Mat & _src_matx,xF::Mat & _src_maty,xF::Mat & _dst_mat)
Parameter Descriptions
The following table describes the template and the function parameters.
Parameter | Description |
---|---|
NORM_TYPE | Normalization type can be either L1 or L2 norm. Values are XF_L1NORM or XF_L2NORM |
SRC_T | Input pixel type. Only 16-bit, signed, 1 channel is supported (XF_16SC1) |
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 values are XF_NPPC1 and XF_NPPC8 for 1 pixel and 8 pixel operations respectively. |
_src_matx | First input, x-gradient image. |
_src_maty | Second input, y-gradient image. |
_dst_mat | Output, magnitude computed image. |
Resource Utilization
The following table summarizes the resource utilization of the kernel in different configurations, generated usingVivado HLS 2017.1tool for theXilinx Xczu9eg-ffvb1156-1-i-es1FPGA, to process a grayscale HD (1080x1920) image and for L2 normalization.
Name | Resource Utilization | |
---|---|---|
1 pixel | 8 pixel | |
300 MHz | 150 MHz | |
BRAM_18K | 0 | 0 |
DSP48E | 2 | 16 |
FF | 707 | 2002 |
LUT | 774 | 3666 |
CLB | 172 | 737 |
Performance Estimate
The following table summarizes the performance of the kernel in different configurations, as generated usingVivado HLS 2017.1tool for theXilinx Xczu9eg-ffvb1156-1-i-es1, to process a grayscale HD (1080x1920) image and for L2 normalization.
Operating Mode | Operating Frequency (MHz) |
Latency Estimate |
---|---|---|
Max (ms) | ||
1 pixel | 300 | 7.2 |
8 pixel | 150 | 1.7 |