我正在尝试从Android使用opencv的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++中的vector之类的东西, Mat c++就有了。

所以问题是有什么办法从android中的列表创建Mat吗?谢谢你的帮助...

最佳答案

如果您将OpenCV 2.3.1用于Android,则将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<T>类型都替换为MatOfT类型,以防止在本机和Java之间来回复制数据。

10-02 02:17
查看更多