title: how to obtain accurate depth map?
body: <pre><code>using namespace std;
  using namespace cv;
  
  int main(int argc, char**argv)
  {
      long lframecount=0;
      //load the videos
      VideoCapture capture1(argv[1]); 
      VideoCapture capture2(argv[2]);
      cout &lt;&lt; argv[1]  &lt;&lt; endl;
      cout &lt;&lt; argv[2]  &lt;&lt; endl;
  
      if(!capture1.isOpened()||!capture2.isOpened())
      {
          cout&lt;&lt;"cant load stereo video";
          return -1;
      }
  
      Mat frame1,frame2;
      capture1&gt;&gt; frame1;
      capture2&gt;&gt; frame2;
      long framecount1= capture1.get(CV_CAP_PROP_FRAME_COUNT);
      long framecount2= capture2.get(CV_CAP_PROP_FRAME_COUNT);
  
  
  
      namedWindow("depthmap",cv::WINDOW_NORMAL);
  
  
      cv::Mat disp;
      cv::Mat vdisp;
      for(long i=1;i&lt;5;i++)
      {
          lframecount++;
          int number=lframecount;
          string frame;
          std::ostringstream convert;
          convert&lt;&lt;number;
          frame = convert.str();
          //cout&lt;&lt;lframecount&lt;&lt;"\n";
          capture1 &gt;&gt; frame1;
          capture2 &gt;&gt; frame2;
          cv::StereoVar stereo;
  
          stereo.minDisp=-80;
          stereo.maxDisp=80;
          stereo(frame1,frame2,disp);
          double min, max;
          minMaxLoc(disp, &amp;min, &amp;max);
          disp.convertTo(vdisp, CV_8U, -255.0/max, 255);
  
          std::cout&lt;&lt;"framecount :"&lt;&lt; frame&lt;&lt;std::endl;
          imshow("depthmap",vdisp);
          waitKey(30);
          write &lt;&lt; vdisp;
          //waitKey(30);
          //if(waitKey(0))
          //break;
      }
      write.release();
      cv::destroyAllWindows();
      return 0;
  }
  </code></pre>
  
  <p>here is my code.I am getting lot of noise in the image.I am using the image taken from my camera.can anyone suggest me a good method?or can  anyone point out the error?am using stereo var function avaliable in the opencv..is ther anyother function which will give better results?</p>