title: opencv sgbm produces outliers on object edges
body: <p>I am using opencv sgmb for stereo disparity computation in order to reconstruct some simple object put on the table. Everything works more or less well, except that on the edges of the object I find some outliers stuck it with the color of the background. The thing is I think that sgbm mismatches this background points which are neighbors to the edges of the object and they get the same disparity value as those edges.
  This is one example <img src="https://i.stack.imgur.com/qLWYn.png" alt="first rectified image"> <img src="https://i.stack.imgur.com/Tz0F6.png" alt="second rectified image"> <img src="https://i.stack.imgur.com/40HVG.png" alt="disparity image"> <img src="https://i.stack.imgur.com/xtLZB.png" alt="3D"></p>
  
  <p>As you can see some images from the floor are stuck to the object. I am using standard values for sgbm parameters:</p>
  
  <pre><code>int sgbmWinSize = 3;//size of the window to be matched
  int numberOfDisparities = 256; //number of different disparity values in pixels
  
  int cn = inputImage1.channels();
  
  sgbm.minDisparity = -128; //minimum possible disparity value in pixels
  sgbm.SADWindowSize = sgbmWinSize;
  sgbm.numberOfDisparities = numberOfDisparities;
  //parameters controling disparity smoothness 
  //values taken from openCV example
  //additional tuning may be needed
  sgbm.P1 = 8 * cn*sgbmWinSize*sgbmWinSize;
  sgbm.P2 = 32 * cn*sgbmWinSize*sgbmWinSize;
  
  sgbm.uniquenessRatio = 1;
  
  //parameters for speckle filtering
  sgbm.speckleWindowSize = 100;
  sgbm.speckleRange = 5;
  
  //maximum difference value in left-right disparity check
  sgbm.disp12MaxDiff = 1;
  
  //wether to run the full dp algorithm
  //if set to true it may consume a lot of memory
  sgbm.fullDP = true;
  sgbm.preFilterCap = 4;
  </code></pre>
  
  <p>I have tried changing and tuning the parameters to get better disparity, but no matter what I do some background points are still stuck to the object. 
  Have anyone had similar experience? Does anyone know a way to overcome this issue?</p>