我正在尝试使用 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(或者我错了吗??,如果错了请更正)并且没有接受 List 或 vector 之类的 Mat 构造函数在 c++ 中,而 Mat c++ 有。
所以问题是有没有办法在 Android 中从 List 创建 Mat?感谢您的帮助...
最佳答案
如果您使用 OpenCV 2.3.1 for 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
防止在 native 和 Java 之间来回复制数据的类型。
关于java - Android OpenCV List<KeyPoint> 到 Mat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10137249/