Gradient Phase - 2023.1 English

Vitis Libraries

Release Date
2023-12-20
Version
2023.1 English

The phase function computes the polar angles of two 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 radians:

image72

For degrees:

image73

API Syntax

template<int RET_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 phase(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.

Table 527 Table . phase Parameter Description
Parameter Description
RET_TYPE

Output format can be either in radians or degrees. Options are XF_RADIANS or XF_DEGREES.

  • If the XF_RADIANS option is selected, phase API will return result in Q4.12 format. The output range is (0, 2 pi).
  • If the XF_DEGREES option is selected, xFphaseAPI will return result in Q10.6 degrees and output range is (0, 360).
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 a multiple of 8, for 8-pixel operation)
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.
XFCVDEPTH_IN_X Depth of the input image.
XFCVDEPTH_IN_Y Depth of the input image.
XFCVDEPTH_OUT_1 Depth of the output image.
_src_matx First input, x-gradient image.
_src_maty Second input, y-gradient image.
_dst_mat Output, phase 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.

Table 528 Table . phase Function Resource Utilization Summary
Name Resource Utilization
1 pixel per clock operation 8 pixel per clock operation
300 MHz 150 MHz
BRAM_18K 6 24
DSP48E 6 19
FF 873 2396
LUT 753 3895
CLB 187 832

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.

Table 529 Table . phase Function Performance Estimate Summary
Operating Mode Operating Frequency (MHz) Latency Estimate (ms)
1 pixel 300 7.2
8 pixel 150 1.7

Deviation from OpenCV

In phase implementation, the output is returned in a fixed point format. If XF_RADIANS option is selected, phase API will return result in Q4.12 format. The output range is (0, 2 pi). If XF_DEGREES option is selected, phase API will return result in Q10.6 degrees and output range is (0, 360).