Emgu.CV.StereoBM.FindStereoCorrespondence C# (CSharp) Method

FindStereoCorrespondence() public method

Computes disparity map for the input rectified stereo pair.
Invalid pixels (for which disparity can not be computed) are set to (state->minDisparity-1)*16
public FindStereoCorrespondence ( Byte>.Image left, Byte>.Image right, Int16>.Image disparity ) : void
left Byte>.Image The left single-channel, 8-bit image
right Byte>.Image The right image of the same size and the same type
disparity Int16>.Image The output single-channel 16-bit signed disparity map of the same size as input images. Its elements will be the computed disparities, multiplied by 16 and rounded to integer's
return void
        public void FindStereoCorrespondence(Image<Gray, Byte> left, Image<Gray, Byte> right, Image<Gray, Int16> disparity)
        {
            CvInvoke.cvFindStereoCorrespondenceBM(left, right, disparity, ref State);
        }

Same methods

StereoBM::FindStereoCorrespondence ( Byte>.Image left, Byte>.Image right, float>.Image disparity ) : void

Usage Example

Example #1
0
        public void TestStereoBMCorrespondence()
        {
            Image<Gray, Byte> left = new Image<Gray, byte>("left.jpg");
             Image<Gray, Byte> right = new Image<Gray, byte>("right.jpg");
             Image<Gray, Int16> leftDisparity = new Image<Gray, Int16>(left.Size);
             Image<Gray, Int16> rightDisparity = new Image<Gray, Int16>(left.Size);

             StereoBM bm = new StereoBM(Emgu.CV.CvEnum.STEREO_BM_TYPE.BASIC, 0);
             Stopwatch watch = Stopwatch.StartNew();
             bm.FindStereoCorrespondence(left, right, leftDisparity);
             watch.Stop();

             Trace.WriteLine(String.Format("Time used: {0} milliseconds", watch.ElapsedMilliseconds));

             Matrix<double> q = new Matrix<double>(4, 4);
             q.SetIdentity();
             MCvPoint3D32f[] points = PointCollection.ReprojectImageTo3D(leftDisparity * (-16), q);

             float min = (float)1.0e10, max = 0;
             foreach (MCvPoint3D32f p in points)
             {
            if (p.z < min) min = p.z;
            else if (p.z > max) max = p.z;
             }
             Trace.WriteLine(String.Format("Min : {0}\r\nMax : {1}", min, max));
        }
All Usage Examples Of Emgu.CV.StereoBM::FindStereoCorrespondence