Browse Source

Added support for disparity image of type Image<Gray, Byte> on PointCollection.ReprojectImageTo3D function.

git-svn-id: https://emgucv.svn.sourceforge.net/svnroot/emgucv/trunk@1060 d7f09016-e345-0410-b530-edf29a71df78
UWP10
canming 15 years ago
parent
commit
ecd0ac06eb
  1. 19
      Emgu.CV/PointAndLine/PointCollection.cs

19
Emgu.CV/PointAndLine/PointCollection.cs

@ -316,6 +316,25 @@ namespace Emgu.CV
return points3D;
}
/// <summary>
/// Reproject pixels on a 1-channel disparity map to array of 3D points.
/// </summary>
/// <param name="disparity">Disparity map</param>
/// <param name="Q">The reprojection 4x4 matrix, can be arbitrary, e.g. the one, computed by cvStereoRectify</param>
/// <returns>The reprojected 3D points</returns>
public static MCvPoint3D32f[] ReprojectImageTo3D(Image<Gray, Byte> disparity, Matrix<double> Q)
{
Size size = disparity.Size;
MCvPoint3D32f[] points3D = new MCvPoint3D32f[size.Width * size.Height];
GCHandle handle = GCHandle.Alloc(points3D, GCHandleType.Pinned);
using (Matrix<float> pts = new Matrix<float>(size.Height, size.Width, 3, handle.AddrOfPinnedObject(), 0))
CvInvoke.cvReprojectImageTo3D(disparity.Ptr, pts.Ptr, Q);
handle.Free();
return points3D;
}
/// <summary>
/// Generate a random point cloud around the ellipse.
/// </summary>

Loading…
Cancel
Save