java - Android OpenCV List<KeyPoint> 到 Mat

标签 java android image opencv

我正在尝试使用 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/

相关文章:

ios - uiscrollview 在 imageview 中改变图像

java - Apache Common Pool实现的TCP连接池中的非持久连接

Java、BlazeDS、Flex - 错误 #10566 : Cannot create property smallMessage on AcknowledgeMessage?

java - 在Java中设置小写字母后跟大写字母之间的句点

java - Android/Firebase - 如何将检索到的数据添加到 ArrayList

android - 如何在android中添加多个按钮到scrollview

android - 将 css 渐变转换为 android 渐变 (xml)

java - 2 个不同的 Json 对象作为响应打印,如何将它们分开并读取第二个对象中元素的值

安卓 : Changing color of an image using seekbar

html - 如何使用浏览器 control+F 在图像中查找文本