Ask Your Question

How does stereo SGBM algorithm really work inside ?

asked 2019-07-11 12:15:04 -0500

kobeking gravatar image

updated 2019-07-12 02:14:13 -0500

Hello everyone,

I have been playing with stereo BM & stereo SGBM for a little while now, and even if I understood in details how the BM algorithm works, I am still struggling a lot to understand the latter. I have tried to read all relevant papers : Stereo Processing by Semi-Global Matching and Mutual Information by Heiko Hirschmüller, Learning OpenCV 3 by Adrian Kaehler and Gary Bradski, Depth Discontinuities by Pixel-to-Pixel Stereo by Stan Birchfield and Carlo Tomasi, and also looked at many other thesis on the subject, yet I haven't been able to understand how the SGBM algorithme (which is a combination of BM with a variation of SGM) really works inside.

What I mainly don't understand are the following :

1) What is the Birchfield-Tomasi metric used in the algorithm ? Every paper relates to a "Birchfield-Tomasi metric" but no one explains what it is and reading the Birchfield-Tomasi paper didn't help me to understand that.

2) How is a window used in that algorithm (what is the operation made with that window)?

3) Why is there a preFilterCap in this algorithm if the filter type can only be a Sobel (in contrast with BM algorithm where there is a choice between Sobel & an other prefilter where preFilterCap is used)?

4) And finally, what are the different directions that can be used (3, 5 or 8) ? aren't we supposed to compute a cost matching only on the epipolar lines ?

It is really frustrating for me, I have spent the last entire 2 days trying to figure this out and haven't been able to do so,and I really need to be able to explain that in my thesis.

Any help would be more than welcome !

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2019-07-15 12:03:10 -0500

michaelr gravatar image

The metric is the pixel similarity measure -it is described in section 2.1.2 ("Pixel Dissimilarity") of the ICCV '98 paper (see here: )

edit flag offensive delete link more


Thank you for your reply! It is very helpful.

Have you any idea of how to explain the "directions" that can be used (3, 5 or 8)? I couldn't understand this part.

kobeking gravatar imagekobeking ( 2019-08-09 10:58:40 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-07-11 12:15:04 -0500

Seen: 38 times

Last updated: Jul 12