WarpAffine

Affine Transformation is used to express rotation, scaling and translation operations.

xFWarpAffinetakes inverse transformation as input and transforms the input image by matrix multiplication with 2x3 matrix.Calculate the input position corresponding to every output pixel in the following way.









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 void xFwarpAffine(xF::Mat & _src, xF::Mat & _dst, float* transformation_matrix)

Parameter Descriptions

The following table describes the template and the function parameters.

Table 1.xFwarpAffine Function Parameter Descriptions
Parameter Description
INTERPOLATION_TYPE

Interpolation technique to be used

XF_INTERPOLATION_NN - Nearest Neighbor

XF_INTERPOLATION_BILINEAR - Bilinear

SRC_T Input pixel type.
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 Input Image pointer
_dst Output Image pointer
transformation_matrix Inverse Affine Transformation matrix

Resource Utilization

The following table shows the resource utilization of xFWarpAffine in different configurations as generated inVivado HLS 2017.1version tool for the part Xilinx Xczu9eg-ffvb1156-1-i-es1.

Table 2.xFwarpAffine Function Resource Utilization Summary
Name Utilization (at 250 MHz)

Normal Operation

(1 pixel) Mode

Resource Optimized

(8 pixel) Mode

Nearest Neighbour Bilinear Inerpolation Nearest Neighbour Bilinear Interpolation
BRAM 200 194 200 200
DSP48E 121 125 139 155
FF 9523 10004 8070 9570
LUT 9928 10592 13296 13894
CLB 2390 2435 2932 2829
Note:NO is single pixel processing and RO is 4-pixel processing.

Performance Estimate

The following table shows the performance of Affine Transformation in different configurations, as generated inVivado HLS 2017.1version tool for the part Xilinx Xczu9eg-ffvb1156-1-i-es1.

Table 3.xFwarpAffine Function Performance Estimate Summary
Latency Estimate
1pixel(300 MHz) 8pixel(150 MHz)
Nearest Neighbour

Bilinear

Interpolation

Nearest Neighbour

Bilinear

Interpolation

Max(in ms) Max(in ms) Max(in ms) Max(in ms)
10.4 19.3 10.7 10.4