Gradient Phase

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

For degrees:

API Syntax

template void xFphase(xF::Mat & _src_matx,xF::Mat & _src_maty,xF::Mat & _dst_mat)

Parameter Descriptions

The following table describes the template and the function parameters.

Table 1.xFphase Function Parameter Descriptions
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, xFphase 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 (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_matx First input, x-gradient image.
_src_maty Second input, y-gradient image.
_dst_mat Output, phase computed image.
  1. If XF_RADIANS options is selected, xFphase API will return result in Q4.12 format. The output range is (0, 2pi)
  2. If XF_DEGREES options is selected, xFphase API will return result in Q10.6 degrees and output range is (0, 360)

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-es11 FPGA, to process a grayscale HD (1080x1920) image.

Table 2.xFphase Function Resource Utilization Summary
Name Resource Utilization
1 pixel 8 pixel
300 MHz 150 MHz
BRAM_18K 6 24
DSP48E 6 19
FF 873 2396
LUT 753 3895
CLB 185 832

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.

Table 3.xFphase Function Performance Estimate Summary
Operating Mode

Operating Frequency (MHz)

Latency Estimate (ms)

1 pixel 300 7.2
8 pixel 150 1.7

Deviation fromOpenCV

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