【问题标题】:Android OpenCV List<KeyPoint> to MatAndroid OpenCV List<KeyPoint> 到 Mat
【发布时间】:2012-04-25 14:32:58
【问题描述】:

我正在尝试使用来自 opencv for android 的 stereouncalibratedrectify

我没有找到在java中从List转换为Mat的方法,但是在opencv c++中我们可以从vector创建一个Mat

这是我做的步骤:

//find fundamental matrix
//srcmatchkey and dstmatchkey are List<Point> as required in findFundamentalMat function,    

they have been calculated using FLANN Matcher


Cali3D.findFundamentalMat(srcMatchKey, dstMatchKey, Calib3d.FM_8POINT);

//this is the strange part

Calib3D.stereoRectifyUncalibrated(Mat points1,Mat,points1,Mat fundamentalMatrix,Mat H1,Mat H2)

据我了解,Mat points1 和 Mat points2 是由 srcMatchKey 和 dstMatchKey 制成的 Mat(或者我错了吗??,如果错了请更正)并且没有 Mat 构造函数接受 List 或类似向量的东西在 c++ 中,而 Mat c++ 有。

所以问题是有没有办法在 android 中从 List 创建 Mat?感谢您的帮助...

【问题讨论】:

    标签: java android image opencv


    【解决方案1】:

    如果你使用 Android 的 OpenCV 2.3.1,将 List 转换为 Mat 的代码是:

      List<Point> lp = null;
      Mat mp = Converters.vector_Point_to_Mat(lp);
    

    或者说stereoRectifyUncalibrated()可以是:

      Mat mp = Converters.vector_Point2d_to_Mat(lp);
    

    在适用于 Android 的 OpenCV 2.4.beta(最近发布)中,所有 List&lt;T&gt; 类型都被替换为 MatOfT 类型,以防止在 Native 和 Java 之间来回复制数据。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-09
      • 1970-01-01
      • 1970-01-01
      • 2014-10-21
      • 2018-07-11
      • 1970-01-01
      • 2012-05-17
      • 1970-01-01
      相关资源
      最近更新 更多