Java API: fixing more tests
authorAndrey Pavlenko <no@email>
Mon, 9 Apr 2012 08:07:18 +0000 (08:07 +0000)
committerAndrey Pavlenko <no@email>
Mon, 9 Apr 2012 08:07:18 +0000 (08:07 +0000)
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
modules/java/android_test/src/org/opencv/test/features2d/BRIEFDescriptorExtractorTest.java
modules/java/android_test/src/org/opencv/test/features2d/BruteForceDescriptorMatcherTest.java
modules/java/android_test/src/org/opencv/test/features2d/BruteForceHammingDescriptorMatcherTest.java
modules/java/android_test/src/org/opencv/test/features2d/BruteForceHammingLUTDescriptorMatcherTest.java
modules/java/android_test/src/org/opencv/test/features2d/BruteForceL1DescriptorMatcherTest.java
modules/java/android_test/src/org/opencv/test/features2d/BruteForceSL2DescriptorMatcherTest.java

index 47f7b41..11f6fcb 100644 (file)
@@ -340,6 +340,12 @@ public class OpenCVTestCase extends TestCase {
             assertDMatchEqual(expected[i], actual[i], epsilon);
     }
 
+    public static void assertListDMatchEquals(List<DMatch> expected, List<DMatch> actual, double epsilon) {
+       DMatch expectedArray[] = expected.toArray(new DMatch[0]);
+       DMatch actualArray[]   = actual.toArray(new DMatch[0]);
+       assertArrayDMatchEquals(expectedArray, actualArray, epsilon);
+    }
+
     public static void assertPointEquals(Point expected, Point actual, double eps) {
         String msg = "expected:<" + expected + "> but was:<" + actual + ">";
         assertEquals(msg, expected.x, actual.x, eps);
index c0f2ce0..ec4b82d 100644 (file)
@@ -2,8 +2,8 @@ package org.opencv.test.features2d;
 
 import org.opencv.core.Core;
 import org.opencv.core.CvType;
-import org.opencv.core.CvVectorKeyPoint;
 import org.opencv.core.Mat;
+import org.opencv.core.MatOfKeyPoint;
 import org.opencv.core.Point;
 import org.opencv.core.Scalar;
 import org.opencv.features2d.DescriptorExtractor;
@@ -38,7 +38,7 @@ public class BRIEFDescriptorExtractorTest extends OpenCVTestCase {
 
     public void testComputeMatListOfKeyPointMat() {
         KeyPoint point = new KeyPoint(55.775577545166016f, 44.224422454833984f, 16, 9.754629f, 8617.863f, 1, -1);
-        CvVectorKeyPoint keypoints = new CvVectorKeyPoint(point);
+        MatOfKeyPoint keypoints = new MatOfKeyPoint(point);
         Mat img = getTestImg();
         Mat descriptors = new Mat();
 
index 807dc1e..d8a8e78 100644 (file)
@@ -6,9 +6,9 @@ import java.util.List;
 
 import org.opencv.core.Core;
 import org.opencv.core.CvType;
-import org.opencv.core.CvVectorDMatch;
-import org.opencv.core.CvVectorKeyPoint;
 import org.opencv.core.Mat;
+import org.opencv.core.MatOfDMatch;
+import org.opencv.core.MatOfKeyPoint;
 import org.opencv.core.Point;
 import org.opencv.core.Scalar;
 import org.opencv.features2d.DMatch;
@@ -35,7 +35,7 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
 
     private Mat getQueryDescriptors() {
         Mat img = getQueryImg();
-        CvVectorKeyPoint keypoints = new CvVectorKeyPoint();
+        MatOfKeyPoint keypoints = new MatOfKeyPoint();
         Mat descriptors = new Mat();
 
         FeatureDetector detector = FeatureDetector.create(FeatureDetector.SURF);
@@ -61,7 +61,7 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
 
     private Mat getTrainDescriptors() {
         Mat img = getTrainImg();
-        CvVectorKeyPoint keypoints = new CvVectorKeyPoint(new KeyPoint(50, 50, 16, 0, 20000, 1, -1), new KeyPoint(42, 42, 16, 160, 10000, 1, -1));
+        MatOfKeyPoint keypoints = new MatOfKeyPoint(new KeyPoint(50, 50, 16, 0, 20000, 1, -1), new KeyPoint(42, 42, 16, 160, 10000, 1, -1));
         Mat descriptors = new Mat();
 
         DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.SURF);
@@ -168,7 +168,7 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
        final int k = 3; 
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
-        List<CvVectorDMatch> matches = new ArrayList<CvVectorDMatch>();
+        List<MatOfDMatch> matches = new ArrayList<MatOfDMatch>();
         matcher.knnMatch(query, train, matches, k);
         /*
         matcher.add(Arrays.asList(train));
@@ -177,9 +177,9 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
         assertEquals(query.rows(), matches.size());
         for(int i = 0; i<matches.size(); i++)
         {
-               CvVectorDMatch vdm = matches.get(i); 
+               MatOfDMatch vdm = matches.get(i); 
             assertEquals(Math.min(k, train.rows()), vdm.total());
-            for(DMatch dm : vdm.toArray(null))
+            for(DMatch dm : vdm.toArray())
             {
                assertEquals(dm.queryIdx, i);
             }
@@ -197,34 +197,34 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
     public void testMatchMatListOfDMatch() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
-        CvVectorDMatch matches = new CvVectorDMatch();
+        MatOfDMatch matches = new MatOfDMatch();
         matcher.add(Arrays.asList(train));
 
         matcher.match(query, matches);
 
-        assertArrayDMatchEquals(truth, matches.toArray(null), EPS);
+        assertArrayDMatchEquals(truth, matches.toArray(), EPS);
     }
 
     public void testMatchMatListOfDMatchListOfMat() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
         Mat mask = getMaskImg();
-        CvVectorDMatch matches = new CvVectorDMatch();
+        MatOfDMatch matches = new MatOfDMatch();
         matcher.add(Arrays.asList(train));
 
         matcher.match(query, matches, Arrays.asList(mask));
 
-        assertArrayDMatchEquals(Arrays.copyOfRange(truth, 0, 2), matches.toArray(null), EPS);
+        assertArrayDMatchEquals(Arrays.copyOfRange(truth, 0, 2), matches.toArray(), EPS);
     }
 
     public void testMatchMatMatListOfDMatch() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
-        CvVectorDMatch matches = new CvVectorDMatch();
+        MatOfDMatch matches = new MatOfDMatch();
 
         matcher.match(query, train, matches);
 
-        assertArrayDMatchEquals(truth, matches.toArray(null), EPS);
+        assertArrayDMatchEquals(truth, matches.toArray(), EPS);
 
         // OpenCVTestRunner.Log("matches found: " + matches.size());
         // for (DMatch m : matches)
@@ -235,11 +235,11 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
         Mat mask = getMaskImg();
-        CvVectorDMatch matches = new CvVectorDMatch();
+        MatOfDMatch matches = new MatOfDMatch();
 
         matcher.match(query, train, matches, mask);
 
-        assertArrayDMatchEquals(Arrays.copyOfRange(truth, 0, 2), matches.toArray(null), EPS);
+        assertArrayDMatchEquals(Arrays.copyOfRange(truth, 0, 2), matches.toArray(), EPS);
     }
 
     public void testRadiusMatchMatListOfListOfDMatchFloat() {
index 5a95d40..cd32bca 100644 (file)
@@ -1,22 +1,22 @@
 package org.opencv.test.features2d;
 
+import java.util.Arrays;
+import java.util.List;
+
 import org.opencv.core.Core;
 import org.opencv.core.CvType;
 import org.opencv.core.Mat;
+import org.opencv.core.MatOfDMatch;
+import org.opencv.core.MatOfKeyPoint;
 import org.opencv.core.Point;
 import org.opencv.core.Scalar;
 import org.opencv.features2d.DMatch;
 import org.opencv.features2d.DescriptorExtractor;
 import org.opencv.features2d.DescriptorMatcher;
 import org.opencv.features2d.FeatureDetector;
-import org.opencv.features2d.KeyPoint;
 import org.opencv.test.OpenCVTestCase;
 import org.opencv.test.OpenCVTestRunner;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
 public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
 
     DescriptorMatcher matcher;
@@ -42,7 +42,7 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
     }
 
     private Mat getTestDescriptors(Mat img) {
-        List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
+        MatOfKeyPoint keypoints = new MatOfKeyPoint();
         Mat descriptors = new Mat();
 
         FeatureDetector detector = FeatureDetector.create(FeatureDetector.FAST);
@@ -162,45 +162,45 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
     public void testMatchMatListOfDMatch() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
         matcher.add(Arrays.asList(train));
 
         matcher.match(query, matches);
 
-        assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
+        assertListDMatchEquals(Arrays.asList(truth), matches.toList(), EPS);
     }
 
     public void testMatchMatListOfDMatchListOfMat() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
         Mat mask = getMaskImg();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
         matcher.add(Arrays.asList(train));
 
         matcher.match(query, matches, Arrays.asList(mask));
 
-        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
+        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches.toList(), EPS);
     }
 
     public void testMatchMatMatListOfDMatch() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
 
         matcher.match(query, train, matches);
 
-        assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
+        assertListDMatchEquals(Arrays.asList(truth), matches.toList(), EPS);
     }
 
     public void testMatchMatMatListOfDMatchMat() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
         Mat mask = getMaskImg();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
 
         matcher.match(query, train, matches, mask);
 
-        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
+        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches.toList(), EPS);
     }
 
     public void testRadiusMatchMatListOfListOfDMatchFloat() {
index c364cd6..d8f8750 100644 (file)
@@ -1,22 +1,22 @@
 package org.opencv.test.features2d;
 
+import java.util.Arrays;
+import java.util.List;
+
 import org.opencv.core.Core;
 import org.opencv.core.CvType;
 import org.opencv.core.Mat;
+import org.opencv.core.MatOfDMatch;
+import org.opencv.core.MatOfKeyPoint;
 import org.opencv.core.Point;
 import org.opencv.core.Scalar;
 import org.opencv.features2d.DMatch;
 import org.opencv.features2d.DescriptorExtractor;
 import org.opencv.features2d.DescriptorMatcher;
 import org.opencv.features2d.FeatureDetector;
-import org.opencv.features2d.KeyPoint;
 import org.opencv.test.OpenCVTestCase;
 import org.opencv.test.OpenCVTestRunner;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
 public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
 
     DescriptorMatcher matcher;
@@ -42,7 +42,7 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
     }
 
     private Mat getTestDescriptors(Mat img) {
-        List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
+        MatOfKeyPoint keypoints = new MatOfKeyPoint();
         Mat descriptors = new Mat();
 
         FeatureDetector detector = FeatureDetector.create(FeatureDetector.FAST);
@@ -162,49 +162,49 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
     public void testMatchMatListOfDMatch() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
         matcher.add(Arrays.asList(train));
 
         matcher.match(query, matches);
 
-        assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
+        assertArrayDMatchEquals(truth, matches.toArray(), EPS);
     }
 
     public void testMatchMatListOfDMatchListOfMat() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
         Mat mask = getMaskImg();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
         matcher.add(Arrays.asList(train));
 
         matcher.match(query, matches, Arrays.asList(mask));
 
-        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
+        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches.toList(), EPS);
     }
 
     public void testMatchMatMatListOfDMatch() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
 
         matcher.match(query, train, matches);
 
         OpenCVTestRunner.Log("matches found: " + matches.size());
-        for (DMatch m : matches)
+        for (DMatch m : matches.toArray())
             OpenCVTestRunner.Log(m.toString());
 
-        assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
+        assertArrayDMatchEquals(truth, matches.toArray(), EPS);
     }
 
     public void testMatchMatMatListOfDMatchMat() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
         Mat mask = getMaskImg();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
 
         matcher.match(query, train, matches, mask);
 
-        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
+        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches.toList(), EPS);
     }
 
     public void testRadiusMatchMatListOfListOfDMatchFloat() {
index 4be17e8..37209f2 100644 (file)
@@ -1,8 +1,13 @@
 package org.opencv.test.features2d;
 
+import java.util.Arrays;
+import java.util.List;
+
 import org.opencv.core.Core;
 import org.opencv.core.CvType;
 import org.opencv.core.Mat;
+import org.opencv.core.MatOfDMatch;
+import org.opencv.core.MatOfKeyPoint;
 import org.opencv.core.Point;
 import org.opencv.core.Scalar;
 import org.opencv.features2d.DMatch;
@@ -13,10 +18,6 @@ import org.opencv.features2d.KeyPoint;
 import org.opencv.test.OpenCVTestCase;
 import org.opencv.test.OpenCVTestRunner;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
 public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
 
     DescriptorMatcher matcher;
@@ -33,7 +34,7 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
 
     private Mat getQueryDescriptors() {
         Mat img = getQueryImg();
-        List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
+        MatOfKeyPoint keypoints = new MatOfKeyPoint();
         Mat descriptors = new Mat();
 
         FeatureDetector detector = FeatureDetector.create(FeatureDetector.SURF);
@@ -59,7 +60,7 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
 
     private Mat getTrainDescriptors() {
         Mat img = getTrainImg();
-        List<KeyPoint> keypoints = Arrays.asList(new KeyPoint(50, 50, 16, 0, 20000, 1, -1), new KeyPoint(42, 42, 16, 160, 10000, 1, -1));
+        MatOfKeyPoint keypoints = new MatOfKeyPoint(new KeyPoint(50, 50, 16, 0, 20000, 1, -1), new KeyPoint(42, 42, 16, 160, 10000, 1, -1));
         Mat descriptors = new Mat();
 
         DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.SURF);
@@ -176,45 +177,45 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
     public void testMatchMatListOfDMatch() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
         matcher.add(Arrays.asList(train));
 
         matcher.match(query, matches);
 
-        assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
+        assertArrayDMatchEquals(truth, matches.toArray(), EPS);
     }
 
     public void testMatchMatListOfDMatchListOfMat() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
         Mat mask = getMaskImg();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
         matcher.add(Arrays.asList(train));
 
         matcher.match(query, matches, Arrays.asList(mask));
 
-        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
+        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches.toList(), EPS);
     }
 
     public void testMatchMatMatListOfDMatch() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
 
         matcher.match(query, train, matches);
 
-        assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
+        assertArrayDMatchEquals(truth, matches.toArray(), EPS);
     }
 
     public void testMatchMatMatListOfDMatchMat() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
         Mat mask = getMaskImg();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
 
         matcher.match(query, train, matches, mask);
 
-        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
+        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches.toList(), EPS);
     }
 
     public void testRadiusMatchMatListOfListOfDMatchFloat() {
index 42433d7..f9698e1 100644 (file)
@@ -1,8 +1,13 @@
 package org.opencv.test.features2d;
 
+import java.util.Arrays;
+import java.util.List;
+
 import org.opencv.core.Core;
 import org.opencv.core.CvType;
 import org.opencv.core.Mat;
+import org.opencv.core.MatOfDMatch;
+import org.opencv.core.MatOfKeyPoint;
 import org.opencv.core.Point;
 import org.opencv.core.Scalar;
 import org.opencv.features2d.DMatch;
@@ -13,10 +18,6 @@ import org.opencv.features2d.KeyPoint;
 import org.opencv.test.OpenCVTestCase;
 import org.opencv.test.OpenCVTestRunner;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
 public class BruteForceSL2DescriptorMatcherTest extends OpenCVTestCase {
 
     DescriptorMatcher matcher;
@@ -37,7 +38,7 @@ public class BruteForceSL2DescriptorMatcherTest extends OpenCVTestCase {
 
     private Mat getQueryDescriptors() {
         Mat img = getQueryImg();
-        List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
+        MatOfKeyPoint keypoints = new MatOfKeyPoint();
         Mat descriptors = new Mat();
 
         FeatureDetector detector = FeatureDetector.create(FeatureDetector.SURF);
@@ -63,7 +64,7 @@ public class BruteForceSL2DescriptorMatcherTest extends OpenCVTestCase {
 
     private Mat getTrainDescriptors() {
         Mat img = getTrainImg();
-        List<KeyPoint> keypoints = Arrays.asList(new KeyPoint(50, 50, 16, 0, 20000, 1, -1), new KeyPoint(42, 42, 16, 160, 10000, 1, -1));
+        MatOfKeyPoint keypoints = new MatOfKeyPoint(new KeyPoint(50, 50, 16, 0, 20000, 1, -1), new KeyPoint(42, 42, 16, 160, 10000, 1, -1));
         Mat descriptors = new Mat();
 
         DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.SURF);
@@ -181,34 +182,34 @@ public class BruteForceSL2DescriptorMatcherTest extends OpenCVTestCase {
     public void testMatchMatListOfDMatch() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
         matcher.add(Arrays.asList(train));
 
         matcher.match(query, matches);
 
-        assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
+        assertArrayDMatchEquals(truth, matches.toArray(), EPS);
     }
 
     public void testMatchMatListOfDMatchListOfMat() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
         Mat mask = getMaskImg();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
         matcher.add(Arrays.asList(train));
 
         matcher.match(query, matches, Arrays.asList(mask));
 
-        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
+        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches.toList(), EPS);
     }
 
     public void testMatchMatMatListOfDMatch() {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
 
         matcher.match(query, train, matches);
 
-        assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
+        assertArrayDMatchEquals(truth, matches.toArray(), EPS);
 
         // OpenCVTestRunner.Log("matches found: " + matches.size());
         // for (DMatch m : matches)
@@ -219,11 +220,11 @@ public class BruteForceSL2DescriptorMatcherTest extends OpenCVTestCase {
         Mat train = getTrainDescriptors();
         Mat query = getQueryDescriptors();
         Mat mask = getMaskImg();
-        List<DMatch> matches = new ArrayList<DMatch>();
+        MatOfDMatch matches = new MatOfDMatch();
 
         matcher.match(query, train, matches, mask);
 
-        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
+        assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches.toList(), EPS);
     }
 
     public void testRadiusMatchMatListOfListOfDMatchFloat() {