Ask Your Question

Revision history [back]

ReprojectImageTo3D OBJ file

Hi All, I try build a 3D model from stereo Image.

Left: image description

Right: image description

After Calibration, UndistortRectifyMap Left/Right and disparity Image with SGBM algoritm, i have theese images: image description

I use Emgu 4.1

FileStorage fsCam;
Mat Q = new Mat();
fsCam = new FileStorage("Q.xml", FileStorage.Mode.Read);   
fsCam["Qmatrix"].ReadMat(Q);
MCvPoint3D32f[] points = PointCollection.ReprojectImageTo3D(disparity_16S, Q); 

using (System.IO.StreamWriter file =  new System.IO.StreamWriter(saveFileDialogDisparityImage.FileName))
{
  for (int i = 0; i < points.Count(); i++)
  {
    string line = "v " + points[i].X.ToString(System.Globalization.CultureInfo.InvariantCulture) + " " + points[i].Y.ToString(System.Globalization.CultureInfo.InvariantCulture) + " " + points[i].Z.ToString(System.Globalization.CultureInfo.InvariantCulture);
   file.WriteLine(line);
  }
}

I have this OBJ image description

What I've done wrong?