3

I am currently trying to understand how OpenCV's SGBM disparity algorithm works, I know the pixel cost calculations follows Birchfield and Tomasi algorithm. http://robotics.stanford.edu/~birch/publications/dissimilarity_pami1998.pdf

I cannot seem to figure out what is clipTab[TAB_SIZE] and why is it filled this way.

int ftzero = std::max(params.preFilterCap, 15) | 1;
PixType clipTab[TAB_SIZE];

for( k = 0; k < TAB_SIZE; k++ )
    clipTab[k] = (PixType)(std::min(std::max(k - TAB_OFS, -ftzero), ftzero) + ftzero);

The full code can be found using this link:

https://github.com/opencv/opencv/blob/master/modules/calib3d/src/stereosgbm.cpp

C. Jaraque
  • 92
  • 6

1 Answers1

0

It is clip tab for a clip operator after sobel filter.

It will be used during calcPixelCostBT. In my opinions, the useful value of the tab is only the index form (TAB_OFS - ftzero) to (TAB_OFS + ftzero) if you have notice the "tab += tabOfs;" during calcPixelCostBT. The value of tab during this area is [0, 2 * ftzero], which you can get it from the clip rule. the clip rule:

willhua
  • 1
  • 2