Semi Global Method for Stereo Disparity Estimation - 2024.1 English

Vitis Libraries

Release Date
2024-05-30
Version
2024.1 English

Stereo matching algorithms are used for finding relative depth from a pair of rectified stereo images. The resultant disparity information can be used for 3D reconstruction by triangulation, using the known intrinsic and extrinsic parameters of the stereo camera. The Semi global method for stereo disparity estimation aggregates the cost in terms of dissimilarity across multiple paths leading to a smoother estimate of the disparity map.

For the semi-global method in Vitis Vision, census transform in conjunction with Hamming distance is used for cost computation. The semiglobal optimization block is based on the implementation by Hirschmuller, but approximates the cost aggregation by considering only four directions.

Parallelism is achieved by computing and aggregating cost for multiple disparities in parallel, and this parameter is included as a compile-time input.

API Syntax

template<int BORDER_TYPE, int WINDOW_SIZE, int NDISP, int PU, int R, int SRC_T, int DST_T, int ROWS, int COLS, int NPC, int XFCVDEPTH_IN_L = _XFCVDEPTH_DEFAULT, int XFCVDEPTH_IN_R = _XFCVDEPTH_DEFAULT, int XFCVDEPTH_OUT = _XFCVDEPTH_DEFAULT>
void SemiGlobalBM(xf::cv::Mat<SRC_T,ROWS,COLS,NPC,XFCVDEPTH_IN_L> & _src_mat_l, xf::cv::Mat<SRC_T,ROWS,COLS,NPC,XFCVDEPTH_IN_R> & _src_mat_r, xf::cv::Mat<DST_T,ROWS,COLS,NPC,XFCVDEPTH_OUT> & _dst_mat, uint8_t p1, uint8_t p2)

Parameter Descriptions

The following table describes the template and the function parameters.

Table 731 Table . SemiGlobalBM Parameter Description
Parameter Description
BORDER_TYPE The border pixels are processed in Census transform function based on this parameter. Only XF_BORDER_CONSTANT is supported.
WINDOW_SIZE Size of the window used for Census transform computation. Only ‘5’ (5x5) is supported.
NDISP Number of disparities
PU Number of disparity units to be computed in parallel
R Number of directions for cost aggregation. It must be 2, 3, or 4.
SRC_T Type of input image Mat object. It must be XF_8UC1.
DST_T Type of output disparity image Mat object. It must be XF_8UC1.
ROWS Maximum height of the input image.
COLS Maximum width of the input image.
NPC Number of pixels to be computed in parallel. It must be XF_NPPC1.
XFCVDEPTH_IN_L Depth of the input image.
XFCVDEPTH_IN_R Depth of the input image.
XFCVDEPTH_OUT Depth of the output image.
_src_mat_l Left input image Mat
_src_mat_r Right input image Mat
_dst_mat Output disparity image Mat
p1 Small penalty for cost aggregation
p2 Large penalty for cost aggregation. The maximum value is 100.

Resource Utilization

The following table summarizes the resource utilization for a 1920 x 1080 image, with 64 number of disparities, and 32 parallel units.

Table 732 Table . SemiGlobalBM Function Resource Utilization Summary
Operating Mode Filter Size Operating Frequency (MHz) Utilization Estimate
BRAM_18K DSP_48Es FF LUT
1 Pixel 5x5 200 205 141 11856 19102

Performance Estimate

The following table summarizes a performance estimate for a 1920x1080 image.

Table 733 Table . SemiGlobalBM Function Performance Estimate Summary
Operating Mode Operating Frequency Number of Disparities Parallel Units Latency
1 pixel/clock 200 MHz 64 32 42 ms