title: Return the X, Y and Z values of reprojectImageTo3D method in C# using emgu cv
body: <p>I am currently writing a stereo vision program in C# using the Emgu cv framework. The idea is to track a ball within a frame and display its actual distance from the cameras. The tasks I have completed so far are as follows:</p>
  
  <p>1) I have the camera calibration operating with corners of the chessboard being marked by an array of coloured lines and circles.</p>
  
  <p>2) I have added code in order to undistort each image so as to get accurate matches when the disparity map is created.</p>
  
  <p>3) I have the disparity map displayed using stereo block matching and reprojection of image points using the reprojectImageTo3D() method in Emgu Cv</p>
  
  <p>4) I have the ball being tracked in each cameras frame and the x and y coordinates of the balls centre being identified</p>
  
  <p>The issue I am having at the moment however is how do I display the X, Y and Z values of the disparity map contained within the reprojectImageTo3D method? This variable is a type MCvPoint3D32f array which is part of the Emgu Cv class. I have tried the usual ways of retrieving a value from an point array with no success. Below is my method containing this code:</p>
  
  <pre><code>private void Computer3DPointsFromStereoPair(Image&lt;Gray, Byte&gt; left, Image&lt;Gray, Byte&gt; right, out Image&lt;Gray, short&gt; disparityMap, out MCvPoint3D32f[] points)
  {
  
      Size size = left.Size;
  
      disparityMap = new Image&lt;Gray, short&gt;(size);
      //thread safe calibration values
  
  
      using (StereoSGBM stereoSolver = new StereoSGBM(minDisparities, numDisparities, SAD, P1, P2, disp12MaxDiff, PreFilterCap, UniquenessRation, Speckle, SpeckleRange, fullDP))
      //using (StereoBM stereoSolver = new StereoBM(Emgu.CV.CvEnum.Stereo_BM_TYPE.BASIC, 0))
      {
          stereoSolver.FindStereoCorrespondence(left, right, disparityMap);
  
          points = PointCollection.ReprojectImageTo3D(disparityMap, Q);            
      }
  
  }
  </code></pre>
  
  <p>Thanks in advance</p>
  
  <p>Regards</p>
  
  <p>Steve</p>