WarpAffine
Affine Transformation is used to express rotation, scaling and translation operations.
xFWarpAffine takes 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.
API Syntax
template<int INTERPOLATION_TYPE, int SRC_T, int ROWS, int COLS, int NPC=1>
void xFwarpAffine(xF::Mat<SRC_T, ROWS, COLS, XF_NPPC8> & _src, xF::Mat<SRC_T, ROWS, COLS, XF_NPPC8> & _dst, float* transformation_matrix)
Parameter Descriptions
The following table describes the template and the function parameters.
| 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 in Vivado HLS 2017.1 version tool for the part Xilinx Xczu9eg-ffvb1156-1-i-es1.
| 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 |
Performance Estimate
The following table shows the performance of Affine Transformation in different configurations, as generated in Vivado HLS 2017.1 version tool for the part Xilinx Xczu9eg-ffvb1156-1-i-es1.
| 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 |