【问题标题】:Return the X, Y and Z values of reprojectImageTo3D method in C# using emgu cv在 C# 中使用 emgu cv 返回 reprojectImageTo3D 方法的 X、Y 和 Z 值
【发布时间】:2014-06-11 08:04:40
【问题描述】:

我目前正在使用 Emgu cv 框架用 C# 编写立体视觉程序。这个想法是在一个框架内跟踪一个球并显示它与摄像机的实际距离。目前我已经完成的任务如下:

1) 我在用彩色线条和圆圈阵列标记棋盘角的情况下进行相机校准。

2) 我添加了代码,以便在创建视差图时使每个图像不失真,以便获得准确的匹配。

3) 我使用 Emgu Cv 中的 reprojectImageTo3D() 方法使用立体块匹配和图像点重投影显示视差图

4) 我在每个摄像机帧中跟踪球,并确定球中心的 x 和 y 坐标

我现在遇到的问题是如何显示 reprojectImageTo3D 方法中包含的视差图的 X、Y 和 Z 值?这个变量是一个类型为 MCvPoint3D32f 的数组,它是 Emgu Cv 类的一部分。我尝试了从点数组中检索值的常用方法,但没有成功。以下是我包含此代码的方法:

private void Computer3DPointsFromStereoPair(Image<Gray, Byte> left, Image<Gray, Byte> right, out Image<Gray, short> disparityMap, out MCvPoint3D32f[] points)
{

    Size size = left.Size;

    disparityMap = new Image<Gray, short>(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);            
    }

}

提前致谢

问候

史蒂夫

【问题讨论】:

    标签: c# emgucv


    【解决方案1】:

    如果对ReprojectImageTo3D() 的调用成功(points != null),您应该能够通过分别调用points[index].xpoints[index].ypoints[index].z 来访问各个点值,其中index 是一个有效点索引。

    【讨论】:

    • 非常感谢您的回答。效果很好。
    猜你喜欢
    • 1970-01-01
    • 2013-02-26
    • 2013-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多