WarpPerspective

ThexFperspectivefunction performs the perspective transformation on the image. It takes inverse transformation as input and applies perspective transformation with a 3x3 matrix.

Calculate the input position corresponding to every output pixel as following:











Note:Prior scaling of greater than or equal to 0.25 and less than or equal to 8 are supported and throws an assertion if the transformation matrix passed is having unsupported scaling factors.

API Syntax

template< int INTERPOLATION_TYPE ,int SRC_T, int ROWS, int COLS,int NPC> void xFperspective(xF::Mat & _src_mat,xF::Mat & _dst_mat,float *transformation_matrix)

Parameter Descriptions

The following table describes the template and the function parameters.

Table 1.xFperspective Function Parameter Descriptions
Parameter Description
INTERPOLATION_TYPE

Interpolation technique to be used

XF_INTERPOLATION_NN - Nearest Neightbour

XF_INTERPOLATION_BILINEAR - Bilinear

SRC_T Input pixel type. Only 8-bit, unsigned, 1 channel is supported (XF_8UC1)
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_mat Output image
transformation_matrix Inverse Perspective Transformation matrix

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 for Bilinear interpolation.

Table 2.xFperspective Function Resource Utilization Summary

Name

Resource Utilization
1 pixel 8 pixel
300 MHz 150 MHz
BRAM_18K 223 233
DSP48E 191 293
FF 17208 14330
LUT 14458 18969
CLB 3230 3876

Performance Estimate

The following table summarizes the performance of kernel for different configurations, as generated usingVivado HLS 2017.1tool for the Xilinx Xczu9eg-ffvb1156-1-i-es1, to process a grayscale HD (1080x1920) image for Bilinear interpolation.

Table 3.xFperspective Function Performance Estimate Summary
Operating Mode

Operating Frequency

(MHz)

Latency Estimate
Max (ms)
1 pixel 300 19.3
8 pixel 150 15.5