title: Bad Results with Basic Stereo Block Matching (without OpenCV)
body: <p>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. </p>
  
  <p>What I am doing now:</p>
  
  <ol>
  <li>Apply Sobel to left and right image.</li>
  <li>Do block matching
  <ul>
  <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>
  </ul></li>
  </ol>
  
  <p>The resulting disparity is how many steps I had to go right to find the best match.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>The result doesn't look very wrong but very sparse.</p>
  
  <p>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?</p>
  
  <p>Any help is appreciated!</p>
  
  <p>My input is the Tsukuba Stereo Pair. </p>
  
  <p>Result found on the web (2nd is OpenCV BM, 3rd apparently is SAD BM from Blog authors)</p>
  
  <p><a href="http://cseautonomouscar2012.files.wordpress.com/2012/11/111412_2001_comparisono1.png" rel="noreferrer">http://cseautonomouscar2012.files.wordpress.com/2012/11/111412_2001_comparisono1.png</a></p>