The magnitude
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, int XFCVDEPTH_IN_X = _XFCVDEPTH_DEFAULT, int XFCVDEPTH_IN_Y = _XFCVDEPTH_DEFAULT, int XFCVDEPTH_OUT = _XFCVDEPTH_DEFAULT>
void magnitude(xf::cv::Mat<SRC_T, ROWS, COLS, NPC, XFCVDEPTH_IN_X> & _src_matx,xf::cv::Mat<DST_T, ROWS, COLS, NPC, XFCVDEPTH_IN_Y> & _src_maty,xf::cv::Mat<DST_T, ROWS, COLS, NPC, XFCVDEPTH_OUT> & _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. |
COLS | Maximum width of input and output image (must be multiple of 8, for 8-pixel operation) |
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. |
XFCVDEPTH_IN_X | Depth of the input image. |
XFCVDEPTH_IN_Y | Depth of the input image. |
XFCVDEPTH_OUT | Depth of the output image. |
_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 using Vivado HLS 2019.1 tool for the Xczu9eg-ffvb1156-1-i-es1 FPGA, to process a grayscale HD (1080x1920) image and for L2 normalization.
Name | Resource Utilization | |
---|---|---|
1 pixel per clock operation | 8 pixel per clock operation | |
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 using Vivado HLS 2019.1 tool for the Xczu9eg-ffvb1156-1-i-es1, to process a grayscale HD (1080x1920) image and for L2 normalization.
Operating Mode | Latency Estimate |
---|---|
Max Latency (ms) | |
1 pixel operation (300 MHz) | 7.2 |
8 pixel operation (150 MHz) | 1.7 |