import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
+import android.util.Log;
+
public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
DescriptorMatcher matcher;
matSize = 100;
truth = new DMatch[] {
+ /*
new DMatch(0, 0, 0, 0.643284f),
new DMatch(1, 1, 0, 0.92945856f),
new DMatch(2, 1, 0, 0.2841479f),
new DMatch(3, 1, 0, 0.9194034f),
- new DMatch(4, 1, 0, 0.3006621f) };
+ new DMatch(4, 1, 0, 0.3006621f)
+ */
+ new DMatch(0, 0, 0, 1.049694f),
+ new DMatch(1, 0, 0, 1.083795f),
+ new DMatch(2, 1, 0, 0.484352f),
+ new DMatch(3, 0, 0, 1.098605f),
+ new DMatch(4, 1, 0, 0.494587f)
+ };
super.setUp();
}
{
MatOfDMatch vdm = matches.get(i);
assertEquals(Math.min(k, train.total()), vdm.total());
+ Log.d("knn", "vdm["+i+"]="+vdm.dump());
for(DMatch dm : vdm.toArray())
{
assertEquals(dm.queryIdx, i);
detector.write(filename);
- String truth = "<?xml version=\"1.0\"?>\n<opencv_storage>\n<threshold>10</threshold>\n<nonmaxSuppression>1</nonmaxSuppression>\n</opencv_storage>\n";
+ 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));
}
detector.write(filename);
- String truth = "%YAML:1.0\nthreshold: 10\nnonmaxSuppression: 1\n";
+ String truth = "%YAML:1.0\nname: \"Feature2D.FAST\"\nnonmaxSuppression: 1\nthreshold: 10\n";
assertEquals(truth, readFile(filename));
}
matSize = 100;
truth = new DMatch[] {
+ /*
new DMatch(0, 0, 0, 0.643284f),
new DMatch(1, 1, 0, 0.92945856f),
new DMatch(2, 1, 0, 0.2841479f),
new DMatch(3, 1, 0, 0.9194034f),
- new DMatch(4, 1, 0, 0.3006621f) };
+ new DMatch(4, 1, 0, 0.3006621f)
+ */
+ new DMatch(0, 0, 0, 1.049694f),
+ new DMatch(1, 0, 0, 1.083795f),
+ new DMatch(2, 1, 0, 0.484352f),
+ new DMatch(3, 0, 0, 1.098605f),
+ new DMatch(4, 1, 0, 0.494587f)
+ };
super.setUp();
}
matcher.match(query, train, matches);
assertArrayDMatchEquals(new DMatch[]{
+ /*
new DMatch(0, 0, 0, 0),
new DMatch(1, 2, 0, 0),
new DMatch(2, 1, 0, 0),
- new DMatch(3, 3, 0, 0)}, matches.toArray(), EPS);
+ new DMatch(3, 3, 0, 0)
+ */
+ new DMatch(1, 2, 0, 42),
+ new DMatch(2, 1, 0, 40),
+ new DMatch(3, 3, 0, 53)
+ }, matches.toArray(), EPS);
}
public void testTrain() {
Mat truth = new Mat(1, 32, CvType.CV_8UC1) {
{
- put(0, 0, 20, 51, 88, 22, 14, 181, 78, 111, 36, 144, 62, 0, 188, 196, 4, 8, 133, 80, 96, 18, 64, 29, 0,
- 254, 230, 247, 12, 2, 78, 129, 70, 145);
+ put(0, 0,
+ 6, 74, 6, 129, 2, 130, 56, 0, 36, 132, 66, 165, 172, 6, 3, 72, 102, 61, 163, 214, 0, 144, 65, 232, 4, 32, 138, 129, 4, 21, 37, 88);
}
};
assertMatEqual(truth, descriptors);
Mat truth = new Mat(1, 32, CvType.CV_8UC1) {
{
- put(0, 0, 20, 55, 88, 20, 14, 49, 70, 111, 148, 144, 30, 16, 252, 133, 0, 8, 5, 85, 32, 0, 74, 25, 0,
- 252, 119, 191, 4, 2, 66, 1, 66, 145);
+ put(0, 0,
+ 6, 10, 22, 5, 2, 130, 56, 0, 44, 164, 66, 165, 140, 6, 1, 72, 38, 61, 163, 210, 0, 208, 1, 104, 4, 32, 10, 131, 0, 37, 37, 67);
}
};
assertMatEqual(truth, descriptors);
extractor.write(filename);
- String truth = "<?xml version=\"1.0\"?>\n<opencv_storage>\n<scaleFactor>1.2000000476837158e+00</scaleFactor>\n<nLevels>3</nLevels>\n<firstLevel>0</firstLevel>\n<edgeThreshold>31</edgeThreshold>\n<patchSize>31</patchSize>\n</opencv_storage>\n";
+ String truth = "<?xml version=\"1.0\"?>\n<opencv_storage>\n<name>Feature2D.ORB</name>\n<WTA_K>2</WTA_K>\n<edgeThreshold>31</edgeThreshold>\n<firstLevel>0</firstLevel>\n<nFeatures>500</nFeatures>\n<nLevels>8</nLevels>\n<patchSize>31</patchSize>\n<scaleFactor>1.2000000476837158e+00</scaleFactor>\n<scoreType>0</scoreType>\n</opencv_storage>\n";
assertEquals(truth, readFile(filename));
}
extractor.write(filename);
- String truth = "%YAML:1.0\nscaleFactor: 1.2000000476837158e+00\nnLevels: 3\nfirstLevel: 0\nedgeThreshold: 31\npatchSize: 31\n";
+ String truth = "%YAML:1.0\nname: \"Feature2D.ORB\"\nWTA_K: 2\nedgeThreshold: 31\nfirstLevel: 0\nnFeatures: 500\nnLevels: 8\npatchSize: 31\nscaleFactor: 1.2000000476837158e+00\nscoreType: 0\n";
assertEquals(truth, readFile(filename));
}
package org.opencv.test.video;
-import org.opencv.core.Core;
-import org.opencv.core.CvType;
-import org.opencv.core.Mat;
-import org.opencv.core.Point;
-import org.opencv.core.Scalar;
-import org.opencv.highgui.Highgui;
import org.opencv.test.OpenCVTestCase;
-import org.opencv.video.BackgroundSubtractorMOG;
public class BackgroundSubtractorMOGTest extends OpenCVTestCase {