Bad Results with Basic Stereo Block Matching (without OpenCV)


Staff member
I am trying to implement stereo block matching without using OpenCV or other image processing libraries.
All tutorials, books, lecture slides etc. only teach the very basic approach to compare blocks in images but the results are very bad.
I read some papers like the one from K.Konolige, which is the basis of the algorithm in OpenCV, but I still seem to miss something important.

What I am doing now:

<li>Apply Sobel to left and right image.</li>
<li>Do block matching
<li>Pick a (9x9) block around a pixel in the left image and compare with blocks in the same row of the right image (up to a maximum of 80 pixels right of the original block)</li>
<li>Find the one with the best match (using SAD sum of absolute differences)</li>

The resulting disparity is how many steps I had to go right to find the best match.

After reading the Konolige paper I implemented the Left-Right-Check, which, after you have found your best match, you search that best match of the right image in the left image and only accept it if it is the one your originally searched for or right next to it.

Also added a check so that a pixel can only be matched once, using a bitfield pixels will be skipped in searches if they previously have been matched to a pixel.

The result doesn't look very wrong but very sparse.

What is it that I fail to add? Something everybody seems to know but isn't spelled out.
Do I need to add some kind of interpolation?

Any help is appreciated!

My input is the Tsukuba Stereo Pair.

Result found on the web (2nd is OpenCV BM, 3rd apparently is SAD BM from Blog authors)

<a href="" rel="noreferrer"></a>