matSize = 100;
truth = new DMatch[] {
- new DMatch(0, 0, 0, 1.049694f),
- new DMatch(1, 0, 0, 1.066820f),
- new DMatch(2, 1, 0, 0.494587f),
- new DMatch(3, 0, 0, 1.141826f),
- new DMatch(4, 0, 0, 1.084099f)
+ new DMatch(0, 0, 0, 1.0496940f),
+ new DMatch(1, 0, 0, 1.0984558f),
+ new DMatch(2, 1, 0, 0.4945875f),
+ new DMatch(3, 1, 0, 0.48435235f),
+ new DMatch(4, 0, 0, 1.0836693f)
};
super.setUp();
matcher.add(Arrays.asList(train));
matcher.match(query, matches);
+
assertArrayDMatchEquals(truth, matches.toArray(), EPS);
}
matSize = 100;
truth = new DMatch[] {
- new DMatch(0, 1, 0, 6.9202332f),
- new DMatch(1, 0, 0, 6.0567350f),
- new DMatch(2, 1, 0, 2.6798587f),
- new DMatch(3, 0, 0, 5.8991642f),
- new DMatch(4, 0, 0, 6.1321812f)
+ new DMatch(0, 1, 0, 6.9202340f),
+ new DMatch(1, 1, 0, 6.1675916f),
+ new DMatch(2, 1, 0, 2.6798590f),
+ new DMatch(3, 1, 0, 2.6545324f),
+ new DMatch(4, 0, 0, 6.1294870f)
};
super.setUp();
}
matcher.add(Arrays.asList(train));
matcher.match(query, matches);
+
assertArrayDMatchEquals(truth, matches.toArray(), EPS);
}
matSize = 100;
truth = new DMatch[] {
- new DMatch(0, 0, 0, 1.1018578f),
- new DMatch(1, 0, 0, 1.1381058f),
+ new DMatch(0, 0, 0, 1.1018573f),
+ new DMatch(1, 0, 0, 1.2066052f),
new DMatch(2, 1, 0, 0.2446168f),
- new DMatch(3, 0, 0, 1.3037685f),
- new DMatch(4, 0, 0, 1.1752719f)
+ new DMatch(3, 1, 0, 0.23459719f),
+ new DMatch(4, 0, 0, 1.174339f)
};
super.setUp();
matcher.add(Arrays.asList(train));
matcher.match(query, matches);
-OpenCVTestRunner.Log(matches);
-OpenCVTestRunner.Log(matches);
-OpenCVTestRunner.Log(matches);
+ OpenCVTestRunner.Log(matches);
+ OpenCVTestRunner.Log(matches);
+ OpenCVTestRunner.Log(matches);
+
assertArrayDMatchEquals(truth, matches.toArray(), EPS);
}
detector.write(filename);
String truth = "<?xml version=\"1.0\"?>\n<opencv_storage>\n<name>Feature2D.FAST</name>\n<nonmaxSuppression>1</nonmaxSuppression>\n<threshold>10</threshold>\n</opencv_storage>\n";
- assertEquals(truth, readFile(filename));
+ String data = readFile(filename);
+
+ assertEquals(truth, data);
}
public void testWriteYml() {
detector.write(filename);
String truth = "%YAML:1.0\nname: \"Feature2D.FAST\"\nnonmaxSuppression: 1\nthreshold: 10\n";
- assertEquals(truth, readFile(filename));
- }
+ String data = readFile(filename);
+ assertEquals(truth, data);
+ }
}
truth = new DMatch[] {
new DMatch(0, 0, 0, 1.049694f),
- new DMatch(1, 0, 0, 1.066820f),
- new DMatch(2, 1, 0, 0.494587f),
- new DMatch(3, 0, 0, 1.141826f),
- new DMatch(4, 0, 0, 1.084099f)
+ new DMatch(1, 0, 0, 1.0984558f),
+ new DMatch(2, 1, 0, 0.4945875f),
+ new DMatch(3, 1, 0, 0.48435235f),
+ new DMatch(4, 0, 0, 1.0836693f)
};
super.setUp();
truth = new Mat(1, 128, CvType.CV_32FC1) {
{
put(0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 16, 12, 17, 28, 26, 0, 0, 2, 23, 14, 12, 9, 6, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 14, 88, 23, 17, 24, 29, 0, 117, 54, 117, 116, 117, 22, 29, 27, 117, 59, 76, 19, 30, 2, 9, 26, 2, 7, 6, 0, 0,
- 0, 0, 0, 0, 8, 50, 16, 30, 58, 89, 0, 117, 49, 95, 75, 117, 112, 117, 93, 81, 86, 117, 5, 5, 39, 117, 71, 20,
- 20, 12, 0, 0, 1, 20, 19, 0, 0, 0, 2, 14, 4, 1, 0, 69, 0, 0, 14, 90, 31, 35, 56, 25, 0, 0, 0, 0, 2, 12, 16, 0,
- 0, 0, 0, 0, 0, 2, 1);
+ 0, 0, 0, 1, 3, 0, 0, 0, 15, 23, 22, 20, 24, 2, 0, 0, 7, 8, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 16, 13, 2, 0, 0, 117,
+ 86, 79, 68, 117, 42, 5, 5, 79, 60, 117, 25, 9, 2, 28, 19, 11, 13,
+ 20, 2, 0, 0, 5, 8, 0, 0, 76, 58, 34, 31, 97, 16, 95, 49, 117, 92,
+ 117, 112, 117, 76, 117, 54, 117, 25, 29, 22, 117, 117, 16, 11, 14,
+ 1, 0, 0, 22, 26, 0, 0, 0, 0, 1, 4, 15, 2, 47, 8, 0, 0, 82, 56, 31,
+ 17, 81, 12, 0, 0, 26, 23, 18, 23, 0, 0, 0, 0, 0, 0, 0, 0
+ );
}
};
}
public void testRead() {
- MatOfKeyPoint keypoints =new MatOfKeyPoint(keypoint);
+ MatOfKeyPoint keypoints = new MatOfKeyPoint(keypoint);
Mat img = getTestImg();
Mat descriptors = new Mat();
String filename = OpenCVTestRunner.getTempFileName("yml");
writeFile(filename,
- "%YAML:1.0\nmagnification: 3.\nisNormalize: 1\nrecalculateAngles: 1\nnOctaves: 6\nnOctaveLayers: 4\nfirstOctave: -1\nangleMode: 0\n");
+ "%YAML:1.0\nname: \"Feature2D.SIFT\"\ncontrastThreshold: 0.01\nedgeThreshold: 200\nnFeatures: 0\nsigma: 1.6\n");
extractor.read(filename);
extractor.compute(img, keypoints, descriptors);
- assertMatNotEqual(truth, descriptors, EPS);
+
+ assertMatEqual(truth, descriptors, EPS);
}
public void testWrite() {
Mat truth = new Mat(1, 128, CvType.CV_32FC1) {
{
put(0, 0,
- -0.0041138371, 0.0041138371, 0, 0, 0, 0, 0.0014427509, 0.0014427509, -0.0081971241, 0.034624498, 0.032569118,
- 0.032569118, -0.007222258, 0.0076424959, 0.0033254174, 0.0033254174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.10815519, 0.38033518, 0.24314292, 0.24314292, -0.068393648, 0.068393648,
- 0.039715949, 0.039715949, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -8.7263528e-05, 8.7263528e-05, -6.0081031e-05,
- 6.0081031e-05, -0.00012158759, 0.00012158759, 0.0033254174, 0.0033254174, -0.007222258, 0.0076424964,
- 0.0081971241, 0.034624498, -0.032569118, 0.032569118, -0.077379324, 0.27552885, 0.14366581, 0.31175563,
- -0.013609707, 0.24329227, -0.091054246, 0.17476201, 0.022970313, 0.022970313, -0.035123408, 0.035771687,
- 0.1907353, 0.3838968, -0.31571922, 0.31571922, 0.0092833797, 0.0092833797, -0.012892088, 0.012957365,
- 0.029558292, 0.073337689, -0.043703932, 0.043703932, 0.0014427509, 0.0014427509, 0, 0, 0.0041138371,
- 0.0041138371, 0, 0, -0.02955829, 0.073337704, 0.043703932, 0.043703932, -0.012892087, 0.012957364,
- 0.0092833797,0.0092833797, 6.0081031e-05, 6.0081031e-05, 0.00012158759, 0.00012158759, -8.7263528e-05,
- 8.7263528e-05, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- );
+ 0, 0, 0, 0, 0, 0, 0, 0, 0.045382127, 0.075976953, -0.031969212, 0.035002094, 0.012224297,
+ 0.012286193, -0.0088025155, 0.0088025155, 0.00017225844, 0.00017225844, 0, 0, 8.2743405e-05,
+ 8.2743405e-05, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8.2743405e-05, 8.2743405e-05, -0.00017225844,
+ 0.00017225844, 0, 0, 0.31723264, 0.42715758, -0.19872268, 0.23621935, 0.033304065, 0.033918764,
+ -0.021780485, 0.021780485, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.0088025145,
+ 0.0088025145, 0.012224296, 0.012286192, -0.045382123, 0.075976953, 0.031969212, 0.035002094,
+ 0.10047197, 0.21463872, -0.0012294546, 0.18176091, -0.075555265, 0.35627601, 0.01270232,
+ 0.20058797, -0.037658721, 0.037658721, 0.064850949, 0.064850949, -0.27688536, 0.44229308,
+ 0.14888979, 0.14888979, -0.0031531656, 0.0031531656, 0.0068481555, 0.0072466261, -0.034193151,
+ 0.040314503, 0.01108359, 0.023398584, -0.00071876607, 0.00071876607, -0.0031819802,
+ 0.0031819802, 0, 0, -0.0013680183, 0.0013680183, 0.034193147, 0.040314503, -0.01108359,
+ 0.023398584, 0.006848156, 0.0072466265, -0.0031531656, 0.0031531656, 0, 0, 0, 0, 0, 0, 0, 0,
+ -0.0013680183, 0.0013680183, 0, 0, 0.00071876607, 0.00071876607, 0.0031819802, 0.0031819802
+ );
}
};