So, we start with List<DMatch> good_matches . Then you want to add the pt1 and pt2 Point objects to the lists inside your statement " (matchesList.get(i).distance<good_dist) " if, as in List<org.opencv.core.Point> . Then we have
List<DMatch> good_matches; List<org.opencv.core.Point> points1; List<org.opencv.core.Point> points2;
Then we convert the point lists to MatOfPoint2f as follows:
org.opencv.core.Point goodPointArray1[] = new org.opencv.core.Point[goodKeyPoints1.size()]; goodKeyPoints1.toArray(goodPointArray1); MatOfPoint2f keypoints1Mat2f = new MatOfPoint2f(goodPointArray1);
I am sure that more effective ways to do this exist, and I would like to hear them.
source share