InitUndistortRectifyMapInverse - 2023.2 English

Vitis Libraries

Release Date
2023.2 English

The InitUndistortRectifyMapInverse function generates mapx and mapy, based on a set of camera parameters, where mapx and mapy are inputs for the xf::cv::remap function. That is, for each pixel in the location (u, v) in the destination (corrected and rectified) image, the function computes the corresponding coordinates in the source image (the original image from camera). The InitUndistortRectifyMapInverse module is optimized for hardware, so the inverse of rotation matrix is computed outside the synthesizable logic. Note that the inputs are fixed point, so the floating point camera parameters must be type casted to Q12.20 format.

API Syntax

template< int CM_SIZE, int DC_SIZE, int MAP_T, int ROWS, int COLS, int NPC, int XFCVDEPTH_mapx = _XFCVDEPTH_DEFAULT, int XFCVDEPTH_mapy = _XFCVDEPTH_DEFAULT >
void InitUndistortRectifyMapInverse ( ap_fixed<32,12> *cameraMatrix, ap_fixed<32,12> *distCoeffs, ap_fixed<32,12> *ir, xf::cv::Mat<MAP_T, ROWS, COLS, NPC, XFCVDEPTH_mapx> &_mapx_mat, xf::cv::Mat<MAP_T, ROWS, COLS, NPC, XFCVDEPTH_mapy> &_mapy_mat, int _cm_size, int _dc_size)

Parameter Descriptions

The following table describes the template and the function parameters.

Table 602 Table . InitUndistortRectifyMapInverse Function Parameter Descriptions
Parameter Description
CM_SIZE It must be set at the compile time, 9 for 3x3 matrix
DC_SIZE It must be set at the compile time, must be 4,5 or 8
MAP_T It is the type of output maps, and must be XF_32FC1
ROWS Maximum image height, necessary to generate the output maps
COLS Maximum image width, necessary to generate the output maps
NPC Number of pixels per cycle. This function supports only one pixel per cycle, so set to XF_NPPC1
XFCVDEPTH_mapx Depth of the output image.
XFCVDEPTH_mapy Depth of the output image.
cameraMatrix The input matrix representing the camera in the old coordinate system
distCoeffs The input distortion coefficients (k1,k2,p1,p2[,k3[,k4,k5,k6]])
ir The input transformation matrix is equal to Invert(newCameraMatrix*R), where newCameraMatrix represents the camera in the new coordinate system and R is the rotation matrix.. This processing will be done outside the synthesizable block
_mapx_mat Output mat objects containing the mapx
_mapy_mat Output mat objects containing the mapy
_cm_size 9 for 3x3 matrix
_dc_size 4, 5 or 8. If this is 0, then it means there is no distortion

Resource Utilization