title: Remove outlier in Point Cloud
body: <p>With OpenCV/Matlab, I'm computing a disparity map. I use OpenCV SGBM function to get it.
  The result are good. I got a bit of noise in my image. With medfilt2 in Matlab, I remove a lot of bad pixels. </p>
  
  <p>But where the noise is more present than the real data, That create outliers zone (Thing under the plant). I would like to remove all. I'm looking for a better way to do it ?</p>
  
  <p>With the median filter, at least the image get less point projected on the ground plane and less point generated in the top of image where there nothing.</p>
  
  <p>My supposition is :</p>
  
  <ul>
  <li>Remove more noise with a better disparity</li>
  <li>Doing pre-processing on disparity map before reprojectionImageTo3D (OpenCV)</li>
  <li>Doing post-processing on point cloud to remove outlier with Z coordinate and maybe color</li>
  </ul>
  
  <p>I'm not sure how to do it. I looking for nice filtering method that maybe can help me for that. I can work with Matlab and OpenCV as well.</p>
  
  <p>Here an example of my image I have :</p>
  
  <p>Disparity map with noise(Left) and Disparity map with medfilt(Right)
  <img src="https://i.stack.imgur.com/pIHxqm.jpg" alt="Disparity map with noise."><img src="https://i.stack.imgur.com/0YdCum.jpg" alt="Disparity map with medfilt">
  Point cloud generated with noisy disparity map.
  <img src="https://i.stack.imgur.com/DI2kd.png" alt="Point cloud generated with noisy disparity map.">
  Point cloud generated with medfilt disparity map.
  <img src="https://i.stack.imgur.com/JR05N.png" alt="Point cloud generated with medfilt disparity map."></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The problem of the medfilt2 is that I'm using a window size of 65. So it good for the big plant, but the plant near the ground lose their shape and get rounded and fusion with the ground. It normal this is what medfilt do. But I would like to avoid that, I'm searching for a filter that give better result and less noise at the end.</p>