在opencv for android:请问MatOfPoint2f怎么转换为ArrayList
1条回答 默认 最新
关注让阿豪来帮你解答,本回答参考chatgpt3.5编写提供,如果还有疑问可以评论或留言
在OpenCV for Android中,可以使用MatOfPoint2f的toArray()方法将MatOfPoint2f对象转换为Point2f数组,然后再逐个将Point2f对象添加到ArrayList中。 以下是一个示例代码:// 假设有一个MatOfPoint2f对象 named matPoint2f MatOfPoint2f matPoint2f = new MatOfPoint2f(); // 获取Point2f数组 Point[] points = matPoint2f.toArray(); // 创建一个ArrayList对象 ArrayList<Point> pointList = new ArrayList<>(); // 将Point2f数组中的元素逐个添加到ArrayList中 for(Point point : points){ pointList.add(point); }通过上述步骤,就可以将MatOfPoint2f对象转换为ArrayList对象。
解决 无用评论 打赏 举报