Commit a0590273 authored by Andrey Kamaev's avatar Andrey Kamaev

Java API: fixed problems in video and ml modules; generated test stubs for all…

Java API: fixed problems in video and ml modules; generated test stubs for all exported functions (now we have 1701 tests).
parent 9b1cb722
......@@ -1707,7 +1707,7 @@ status(" Documentation:")
status(" Sphinx:" HAVE_SPHINX THEN "${SPHINX_BUILD} (ver ${SPHINX_VERSION})" ELSE NO)
status(" PdfLaTeX compiler:" PDFLATEX_COMPILER THEN "${PDFLATEX_COMPILER}" ELSE NO)
if (BUILD_DOCS AND HAVE_SPHINX)
status(" Build Documentation:" PDFLATEX_COMPILER THEN YES ELSE "YES (HTML only)")
status(" Build Documentation:" PDFLATEX_COMPILER THEN YES ELSE "YES (only HTML without math formulas)")
else()
status(" Build Documentation:" NO)
endif()
......
package org.opencv.test;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.features2d.DMatch;
import org.opencv.features2d.KeyPoint;
import org.opencv.highgui.Highgui;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
......@@ -21,6 +11,16 @@ import java.util.List;
import junit.framework.TestCase;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.features2d.DMatch;
import org.opencv.features2d.KeyPoint;
import org.opencv.highgui.Highgui;
public class OpenCVTestCase extends TestCase {
protected static int matSize = 10;
......@@ -167,24 +167,30 @@ public class OpenCVTestCase extends TestCase {
super.tearDown();
}
public static void assertListIntegerEquals(List<Integer> list1, List<Integer> list2) {
public static <E extends Number> void assertListEquals(List<E> list1, List<E> list2) {
if (list1.size() != list2.size()) {
throw new UnsupportedOperationException();
}
if (!list1.isEmpty())
{
if (list1.get(0) instanceof Float || list1.get(0) instanceof Double)
throw new UnsupportedOperationException();
}
for (int i = 0; i < list1.size(); i++)
assertEquals(list1.get(i), list2.get(i));
}
public static void assertListFloatEquals(List<Float> list1, List<Float> list2, double epsilon) {
public static <E extends Number> void assertListEquals(List<E> list1, List<E> list2, double epsilon) {
if (list1.size() != list2.size()) {
throw new UnsupportedOperationException();
}
for (int i = 0; i < list1.size(); i++)
assertTrue(Math.abs(list1.get(i) - list2.get(i)) <= epsilon);
assertTrue(Math.abs(list1.get(i).doubleValue() - list2.get(i).doubleValue()) <= epsilon);
}
public static void assertListMatEquals(List<Mat> list1, List<Mat> list2, double epsilon) {
if (list1.size() != list2.size()) {
throw new UnsupportedOperationException();
......
package org.opencv.test.android;
import org.opencv.test.OpenCVTestCase;
public class UtilsTest extends OpenCVTestCase {
public void testBitmapToMat() {
fail("Not yet implemented");
}
public void testExportResourceContextInt() {
fail("Not yet implemented");
}
public void testExportResourceContextIntString() {
fail("Not yet implemented");
}
public void testMatToBitmap() {
fail("Not yet implemented");
}
}
......@@ -13,11 +13,7 @@ import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.test.OpenCVTestCase;
public class calib3dTest extends OpenCVTestCase {
public void test_1() {
super.test_1("calib3d");
}
public class Calib3dTest extends OpenCVTestCase {
public void testCalibrateCameraListOfMatListOfMatSizeMatMatListOfMatListOfMat() {
fail("Not yet implemented");
......@@ -238,7 +234,7 @@ public class calib3dTest extends OpenCVTestCase {
assertEquals(CvType.CV_32FC2, centers.type());
}
public void testFindFundamentalMatMatMat() {
public void testFindFundamentalMatListOfPointListOfPoint() {
List<Point> pts1 = new ArrayList<Point>();
List<Point> pts2 = new ArrayList<Point>();
......@@ -257,24 +253,23 @@ public class calib3dTest extends OpenCVTestCase {
assertMatEqual(truth, fm, EPS);
}
public void testFindFundamentalMatMatMatInt() {
public void testFindFundamentalMatListOfPointListOfPointInt() {
fail("Not yet implemented");
}
public void testFindFundamentalMatMatMatIntDouble() {
public void testFindFundamentalMatListOfPointListOfPointIntDouble() {
fail("Not yet implemented");
}
public void testFindFundamentalMatMatMatIntDoubleDouble() {
public void testFindFundamentalMatListOfPointListOfPointIntDoubleDouble() {
fail("Not yet implemented");
}
public void testFindFundamentalMatMatMatIntDoubleDoubleMat() {
public void testFindFundamentalMatListOfPointListOfPointIntDoubleDoubleMat() {
fail("Not yet implemented");
}
public void testFindHomographyMatMat() {
public void testFindHomographyListOfPointListOfPoint() {
List<Point> originalPoints = new ArrayList<Point>();
List<Point> transformedPoints = new ArrayList<Point>();
......@@ -293,15 +288,15 @@ public class calib3dTest extends OpenCVTestCase {
assertMatEqual(truth, hmg, EPS);
}
public void testFindHomographyMatMatInt() {
public void testFindHomographyListOfPointListOfPointInt() {
fail("Not yet implemented");
}
public void testFindHomographyMatMatIntDouble() {
public void testFindHomographyListOfPointListOfPointIntDouble() {
fail("Not yet implemented");
}
public void testFindHomographyMatMatIntDoubleMat() {
public void testFindHomographyListOfPointListOfPointIntDoubleMat() {
fail("Not yet implemented");
}
......@@ -495,7 +490,7 @@ public class calib3dTest extends OpenCVTestCase {
fail("Not yet implemented");
}
public void testSolvePnPMatMatMatMatMatMat() {
public void testSolvePnPListOfPoint3ListOfPointMatMatMatMat() {
Mat intrinsics = Mat.eye(3, 3, CvType.CV_32F);
intrinsics.put(0, 0, 400);
intrinsics.put(1, 1, 400);
......@@ -527,31 +522,31 @@ public class calib3dTest extends OpenCVTestCase {
assertMatEqual(truth_tvec, tvec, EPS);
}
public void testSolvePnPMatMatMatMatMatMatBoolean() {
public void testSolvePnPListOfPoint3ListOfPointMatMatMatMatBoolean() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMat() {
public void testSolvePnPRansacListOfPoint3ListOfPointMatMatMatMat() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMatBoolean() {
public void testSolvePnPRansacListOfPoint3ListOfPointMatMatMatMatBoolean() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMatBooleanInt() {
public void testSolvePnPRansacListOfPoint3ListOfPointMatMatMatMatBooleanInt() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloat() {
public void testSolvePnPRansacListOfPoint3ListOfPointMatMatMatMatBooleanIntFloat() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloatInt() {
public void testSolvePnPRansacListOfPoint3ListOfPointMatMatMatMatBooleanIntFloatInt() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloatIntMat() {
public void testSolvePnPRansacListOfPoint3ListOfPointMatMatMatMatBooleanIntFloatIntMat() {
fail("Not yet implemented");
}
......@@ -582,5 +577,4 @@ public class calib3dTest extends OpenCVTestCase {
public void testValidateDisparityMatMatIntIntInt() {
fail("Not yet implemented");
}
}
......@@ -4,10 +4,6 @@ import org.opencv.test.OpenCVTestCase;
public class StereoBMTest extends OpenCVTestCase {
protected void setUp() throws Exception {
super.setUp();
}
public void testComputeMatMatMat() {
fail("Not yet implemented");
}
......
......@@ -4,10 +4,6 @@ import org.opencv.test.OpenCVTestCase;
public class StereoSGBMTest extends OpenCVTestCase {
protected void setUp() throws Exception {
super.setUp();
}
public void testCompute() {
fail("Not yet implemented");
}
......
......@@ -13,11 +13,7 @@ import org.opencv.core.Scalar;
import org.opencv.test.OpenCVTestCase;
import org.opencv.utils.Converters;
public class coreTest extends OpenCVTestCase {
public void test_1() {
super.test_1("CORE");
}
public class CoreTest extends OpenCVTestCase {
public void testAbsdiff() {
Core.absdiff(gray128, gray255, dst);
......@@ -167,9 +163,8 @@ public class coreTest extends OpenCVTestCase {
try {
Core.checkRange(outOfRange, false);
fail("Core.checkRange should throw the CvException");
} catch (Exception e) {
if (!(e instanceof CvException))
fail("Core.checkRange should throw the CvException");
} catch (CvException e) {
//expected
}
}
......@@ -223,11 +218,9 @@ public class coreTest extends OpenCVTestCase {
Scalar color0 = new Scalar(0);
assertTrue(0 == Core.countNonZero(gray0));
Core.circle(gray0, center2, radius * 2, color128, 2, 4, 1/*
* Number of
Core.circle(gray0, center2, radius * 2, color128, 2, 4, 1/* Number of
* fractional
* bits
*/);
* bits */);
Core.circle(gray0, center, radius, color0, 2, 4, 0);
assertTrue(0 == Core.countNonZero(gray0));
}
......@@ -507,21 +500,21 @@ public class coreTest extends OpenCVTestCase {
lp.add(new Point(1, 1));
lp.add(new Point(5, 1));
lp.add(new Point(5, 8));
lp.add(new Point(1, 8));
lp.add(new Point(1, 8));
Mat points = Converters.vector_Point_to_Mat(lp);
List<Point> lp2 = new ArrayList<Point>();
lp2.add(new Point(0, 0));
lp2.add(new Point(10, 2));
lp2.add(new Point(10, 16));
lp2.add(new Point(2, 16));
Mat points2 = Converters.vector_Point_to_Mat(lp2);
assertEquals(0, Core.countNonZero(gray0));
Core.fillConvexPoly(gray0, points, colorWhite, 4 /*TODO: lineType*/, 0);
Core.fillConvexPoly(gray0, points, colorWhite, 4 /* TODO: lineType */, 0);
assertTrue(0 < Core.countNonZero(gray0));
Core.fillConvexPoly(gray0, points2, colorBlack, 4 /*TODO: lineType*/, 0);
Core.fillConvexPoly(gray0, points2, colorBlack, 4 /* TODO: lineType */, 0);
assertEquals(0, Core.countNonZero(gray0));
}
......@@ -613,6 +606,10 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented");
}
public void testGetNumberOfCPUs() {
fail("Not yet implemented");
}
public void testGetOptimalDFTSize() {
int vecsize = Core.getOptimalDFTSize(0);
assertEquals(1, vecsize);
......
package org.opencv.test.core;
import org.opencv.core.CvType;
import org.opencv.test.OpenCVTestCase;
public class CvTypeTest extends OpenCVTestCase {
public void testMakeType() {
assertEquals(CvType.CV_8UC4, CvType.makeType(CvType.CV_8U, 4));
}
public void testCV_8UC() {
assertEquals(CvType.CV_8UC4, CvType.CV_8UC(4));
}
public void testCV_8SC() {
assertEquals(CvType.CV_8SC4, CvType.CV_8SC(4));
}
public void testCV_16UC() {
assertEquals(CvType.CV_16UC4, CvType.CV_16UC(4));
}
public void testCV_16SC() {
assertEquals(CvType.CV_16SC4, CvType.CV_16SC(4));
}
public void testCV_32SC() {
assertEquals(CvType.CV_32SC4, CvType.CV_32SC(4));
}
public void testCV_32FC() {
assertEquals(CvType.CV_32FC4, CvType.CV_32FC(4));
}
public void testCV_64FC() {
assertEquals(CvType.CV_64FC4, CvType.CV_64FC(4));
}
public void testChannels() {
assertEquals(1, CvType.channels(CvType.CV_64F));
}
public void testDepth() {
assertEquals(CvType.CV_64F, CvType.depth(CvType.CV_64FC3));
}
public void testIsInteger() {
assertFalse(CvType.isInteger(CvType.CV_32FC3));
assertTrue(CvType.isInteger(CvType.CV_16S));
}
public void testELEM_SIZE() {
assertEquals(3 * 8, CvType.ELEM_SIZE(CvType.CV_64FC3));
}
public void testTypeToString() {
assertEquals("CV_32FC1", CvType.typeToString(CvType.CV_32F));
assertEquals("CV_32FC3", CvType.typeToString(CvType.CV_32FC3));
assertEquals("CV_32FC(128)", CvType.typeToString(CvType.CV_32FC(128)));
}
}
package org.opencv.test.core;
import java.util.Arrays;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Scalar;
......@@ -7,8 +9,16 @@ import org.opencv.test.OpenCVTestCase;
public class MatTest extends OpenCVTestCase {
public void test_1() {
super.test_1("Mat");
public void testAdjustROI() {
fail("Not yet implemented");
}
public void testAssignToMat() {
fail("Not yet implemented");
}
public void testAssignToMatInt() {
fail("Not yet implemented");
}
public void testChannels() {
......@@ -17,9 +27,23 @@ public class MatTest extends OpenCVTestCase {
assertEquals(4, rgba0.channels());
}
public void testCheckVectorInt() {
fail("Not yet implemented");
}
public void testCheckVectorIntInt() {
fail("Not yet implemented");
}
public void testCheckVectorIntIntBoolean() {
fail("Not yet implemented");
}
public void testClone() {
dst = gray0.clone();
assertMatEqual(gray0, dst);
assertFalse(gray0.getNativeObjAddr() == dst.getNativeObjAddr());
assertFalse(gray0.dataAddr() == dst.dataAddr());
}
public void testCol() {
......@@ -28,14 +52,30 @@ public class MatTest extends OpenCVTestCase {
assertEquals(gray0.rows(), col.rows());
}
public void testColRange() {
public void testColRangeIntInt() {
Mat cols = gray0.colRange(0, gray0.cols() / 2);
assertEquals(gray0.cols() / 2, cols.cols());
assertEquals(gray0.rows(), cols.rows());
}
public void testColRangeRange() {
fail("Not yet implemented");
}
public void testCols() {
assertEquals(matSize, gray0.rows());
assertEquals(matSize, gray0.cols());
}
public void testConvertToMatInt() {
fail("Not yet implemented");
}
public void testConvertToMatIntDouble() {
fail("Not yet implemented");
}
public void testConvertToMatIntDoubleDouble() {
fail("Not yet implemented");
}
public void testCopyTo() {
......@@ -43,6 +83,22 @@ public class MatTest extends OpenCVTestCase {
assertMatEqual(rgbLena, dst);
}
public void testCopyToMat() {
fail("Not yet implemented");
}
public void testCopyToMatMat() {
fail("Not yet implemented");
}
public void testCreateIntIntInt() {
fail("Not yet implemented");
}
public void testCreateSizeInt() {
fail("Not yet implemented");
}
public void testCross() {
Mat answer = new Mat(1, 3, CvType.CV_32F);
answer.put(0, 0, 7.0, 1.0, -5.0);
......@@ -53,6 +109,7 @@ public class MatTest extends OpenCVTestCase {
public void testDataAddr() {
assertTrue(0 != gray0.dataAddr());
assertEquals(0, new Mat().dataAddr());
}
public void testDepth() {
......@@ -60,12 +117,16 @@ public class MatTest extends OpenCVTestCase {
assertEquals(CvType.CV_32F, gray0_32f.depth());
}
public void testRelease() {
assertTrue(gray0.empty() == false);
assertTrue(gray0.rows() > 0);
gray0.release();
assertTrue(gray0.empty() == true);
assertTrue(gray0.rows() == 0);
public void testDiag() {
fail("Not yet implemented");
}
public void testDiagInt() {
fail("Not yet implemented");
}
public void testDiagMat() {
fail("Not yet implemented");
}
public void testDot() {
......@@ -83,6 +144,10 @@ public class MatTest extends OpenCVTestCase {
assertEquals(3, rgbLena.elemSize());
}
public void testElemSize1() {
fail("Not yet implemented");
}
public void testEmpty() {
assertTrue(dst.empty());
assertTrue(!gray0.empty());
......@@ -93,6 +158,14 @@ public class MatTest extends OpenCVTestCase {
assertMatEqual(eye, eye.inv(), EPS);
}
public void testEyeIntIntInt() {
fail("Not yet implemented");
}
public void testEyeSizeInt() {
fail("Not yet implemented");
}
public void testGetIntInt() {
fail("Not yet implemented");
}
......@@ -102,8 +175,11 @@ public class MatTest extends OpenCVTestCase {
byte[] goodData = new byte[9];
byte[] badData = new byte[7];
m.get(1, 1, goodData);
assertTrue(Arrays.equals(new byte[] { 1, 2, 3, 1, 2, 3, 1, 2, 3 }, goodData));
try {
m.get(2, 2, badData);
m.get(2, 2, badData);
fail("Expected UnsupportedOperationException (data.length % CvType.channels(t) != 0)");
} catch (UnsupportedOperationException e) {
// expected
......@@ -141,6 +217,10 @@ public class MatTest extends OpenCVTestCase {
assertMatEqual(grayE_32f, dst, EPS);
}
public void testInvInt() {
fail("Not yet implemented");
}
public void testIsContinuous() {
assertTrue(gray0.isContinuous());
......@@ -154,9 +234,13 @@ public class MatTest extends OpenCVTestCase {
assertTrue(subMat.isSubmatrix());
}
public void testLocateROI() {
fail("Not yet implemented");
}
public void testMat() {
Mat m = new Mat();
assertTrue(null != m);
assertNotNull(m);
assertTrue(m.empty());
}
......@@ -196,6 +280,50 @@ public class MatTest extends OpenCVTestCase {
assertMatEqual(m2, gray0_32f, EPS);
}
public void testMatLong() {
fail("Not yet implemented");
}
public void testMatMatRange() {
fail("Not yet implemented");
}
public void testMatMatRangeRange() {
fail("Not yet implemented");
}
public void testMatMatRect() {
fail("Not yet implemented");
}
public void testMatSizeInt() {
fail("Not yet implemented");
}
public void testMatSizeIntScalar() {
fail("Not yet implemented");
}
public void testMulMat() {
fail("Not yet implemented");
}
public void testMulMatDouble() {
fail("Not yet implemented");
}
public void testOnesIntIntInt() {
fail("Not yet implemented");
}
public void testOnesSizeInt() {
fail("Not yet implemented");
}
public void testPush_back() {
fail("Not yet implemented");
}
public void testPutIntIntByteArray() {
fail("Not yet implemented");
}
......@@ -203,8 +331,9 @@ public class MatTest extends OpenCVTestCase {
public void testPutIntIntDoubleArray() {
Mat m = new Mat(5, 5, CvType.CV_8UC3);
m.put(1, 1, 10, 20, 30, 40, 50, 60);
try {
m.put(2, 2, 11, 22, 33, 44, 55);
m.put(2, 2, 11, 22, 33, 44, 55);
fail("Expected UnsupportedOperationException (data.length % CvType.channels(t) != 0)");
} catch (UnsupportedOperationException e) {
// expected
......@@ -223,33 +352,92 @@ public class MatTest extends OpenCVTestCase {
fail("Not yet implemented");
}
public void testRelease() {
assertFalse(gray0.empty());
assertTrue(gray0.rows() > 0);
gray0.release();
assertTrue(gray0.empty());
assertEquals(0, gray0.rows());
assertEquals(0, gray0.dataAddr());
}
public void testReshapeInt() {
fail("Not yet implemented");
}
public void testReshapeIntInt() {
fail("Not yet implemented");
}
public void testRow() {
Mat row = gray0.row(0);
assertEquals(1, row.rows());
assertEquals(gray0.cols(), row.cols());
}
public void testRowRange() {
public void testRowRangeIntInt() {
fail("Not yet implemented");
Mat rows = gray0.rowRange(0, gray0.rows() / 2);
assertEquals(gray0.rows() / 2, rows.rows());
assertEquals(gray0.cols(), rows.cols());
}
public void testRowRangeRange() {
fail("Not yet implemented");
}
public void testRows() {
assertEquals(matSize, gray0.rows());
}
public void testSetTo() {
public void testSetToMat() {
fail("Not yet implemented");
}
public void testSetToMatMat() {
fail("Not yet implemented");
}
public void testSetToScalar() {
gray0.setTo(new Scalar(127));
assertMatEqual(gray127, gray0);
}
public void testSize() {
fail("Not yet implemented");
}
public void testStep1() {
fail("Not yet implemented");
}
public void testSubmat() {
public void testStep1Int() {
fail("Not yet implemented");
}
public void testSubmatIntIntIntInt() {
Mat submat = gray0.submat(0, gray0.rows() / 2, 0, gray0.cols() / 2);
assertTrue(submat.isSubmatrix());
assertFalse(submat.isContinuous());
assertEquals(gray0.rows() / 2, submat.rows());
assertEquals(gray0.cols() / 2, submat.cols());
}
public void testSubmatRangeRange() {
fail("Not yet implemented");
}
public void testSubmatRect() {
fail("Not yet implemented");
}
public void testT() {
fail("Not yet implemented");
}
public void testToString() {
assertTrue(null != gray0.toString());
}
......@@ -271,4 +459,12 @@ public class MatTest extends OpenCVTestCase {
assertEquals(rgba128.cols(), rgba128.width());
}
public void testZerosIntIntInt() {
fail("Not yet implemented");
}
public void testZerosSizeInt() {
fail("Not yet implemented");
}
}
......@@ -5,14 +5,14 @@ import org.opencv.core.Point3;
import org.opencv.test.OpenCVTestCase;
public class Point3Test extends OpenCVTestCase {
private Point3 p1;
private Point3 p2;
private Point3 p2;
@Override
protected void setUp() throws Exception {
super.setUp();
p1 = new Point3(2, 2, 2);
p2 = new Point3(1, 1, 1);
}
......@@ -42,9 +42,13 @@ public class Point3Test extends OpenCVTestCase {
assertFalse(flag);
}
public void testHashCode() {
assertEquals(p1.hashCode(), p1.hashCode());
}
public void testPoint3() {
p1 = new Point3();
assertNotNull(p1);
assertTrue(0 == p1.x);
assertTrue(0 == p1.y);
......
......@@ -5,14 +5,14 @@ import org.opencv.core.Rect;
import org.opencv.test.OpenCVTestCase;
public class PointTest extends OpenCVTestCase {
private Point p1;
private Point p2;
private Point p2;
@Override
protected void setUp() throws Exception {
super.setUp();
p1 = new Point(2, 2);
p2 = new Point(1, 1);
}
......@@ -36,6 +36,10 @@ public class PointTest extends OpenCVTestCase {
assertFalse(flag);
}
public void testHashCode() {
assertEquals(p1.hashCode(), p1.hashCode());
}
public void testInside() {
Rect rect = new Rect(0, 0, 5, 3);
assertTrue(p1.inside(rect));
......@@ -46,7 +50,7 @@ public class PointTest extends OpenCVTestCase {
public void testPoint() {
Point p = new Point();
assertNotNull(p);
assertEquals(0.0, p.x);
assertEquals(0.0, p.y);
......@@ -62,7 +66,7 @@ public class PointTest extends OpenCVTestCase {
public void testPointDoubleDouble() {
p1 = new Point(7, 5);
assertNotNull(p1);
assertEquals(7.0, p1.x);
assertEquals(5.0, p1.y);
......
......@@ -5,14 +5,14 @@ import org.opencv.test.OpenCVTestCase;
public class RangeTest extends OpenCVTestCase {
Range range;
Range r1;
Range r2;
Range range;
@Override
protected void setUp() throws Exception {
super.setUp();
range = new Range();
r1 = new Range(1, 11);
r2 = new Range(1, 1);
......@@ -42,11 +42,15 @@ public class RangeTest extends OpenCVTestCase {
public void testEqualsObject() {
assertFalse(r2.equals(r1));
range = r1.clone();
assertTrue(r1.equals(range));
}
public void testHashCode() {
assertEquals(r1.hashCode(), r1.hashCode());
}
public void testIntersection() {
range = r1.intersection(r2);
assertEquals(r2, range);
......@@ -54,7 +58,7 @@ public class RangeTest extends OpenCVTestCase {
public void testRange() {
range = new Range();
assertNotNull(range);
assertEquals(0, range.start);
assertEquals(0, range.end);
......@@ -70,7 +74,7 @@ public class RangeTest extends OpenCVTestCase {
public void testRangeIntInt() {
r1 = new Range(12, 13);
assertNotNull(r1);
assertEquals(12, r1.start);
assertEquals(13, r1.end);
......
......@@ -6,14 +6,14 @@ import org.opencv.core.Size;
import org.opencv.test.OpenCVTestCase;
public class RectTest extends OpenCVTestCase {
private Rect r;
private Rect rect;
@Override
protected void setUp() throws Exception {
super.setUp();
r = new Rect();
rect = new Rect(0, 0, 10, 10);
}
......@@ -38,7 +38,7 @@ public class RectTest extends OpenCVTestCase {
public void testContains() {
Rect rect = new Rect(0, 0, 10, 10);
Point p_inner = new Point(5, 5);
Point p_outer = new Point(5, 55);
Point p_bl = new Point(0, 0);
......@@ -65,9 +65,13 @@ public class RectTest extends OpenCVTestCase {
assertTrue(flag);
}
public void testHashCode() {
assertEquals(rect.hashCode(), rect.hashCode());
}
public void testRect() {
r = new Rect();
assertEquals(0, r.x);
assertEquals(0, r.y);
assertEquals(0, r.width);
......@@ -77,7 +81,7 @@ public class RectTest extends OpenCVTestCase {
public void testRectDoubleArray() {
double[] vals = { 1, 3, 5, 2 };
r = new Rect(vals);
assertEquals(1, r.x);
assertEquals(3, r.y);
assertEquals(5, r.width);
......@@ -86,7 +90,7 @@ public class RectTest extends OpenCVTestCase {
public void testRectIntIntIntInt() {
r = new Rect(1, 3, 5, 2);
assertNotNull(rect);
assertEquals(0, rect.x);
assertEquals(0, rect.y);
......@@ -97,8 +101,8 @@ public class RectTest extends OpenCVTestCase {
public void testRectPointPoint() {
Point p1 = new Point(4, 4);
Point p2 = new Point(2, 3);
r = new Rect(p1, p2);
r = new Rect(p1, p2);
assertNotNull(r);
assertEquals(2, r.x);
assertEquals(3, r.y);
......
......@@ -21,10 +21,6 @@ public class RotatedRectTest extends OpenCVTestCase {
angle = 40;
}
public void test_1() {
super.test_1("core.RotatedRect");
}
public void testBoundingRect() {
size = new Size(matSize / 2, matSize / 2);
assertEquals(size.height, size.width);
......@@ -85,6 +81,11 @@ public class RotatedRectTest extends OpenCVTestCase {
assertTrue(!rrect1.equals(size));
}
public void testHashCode() {
RotatedRect rr = new RotatedRect(center, size, angle);
assertEquals(rr.hashCode(), rr.hashCode());
}
public void testPoints() {
RotatedRect rrect = new RotatedRect(center, size, angle);
......@@ -105,28 +106,28 @@ public class RotatedRectTest extends OpenCVTestCase {
Math.abs((p[1].x + p[3].x) / 2 - center.x) + Math.abs((p[1].y + p[3].y) / 2 - center.y) < EPS);
assertTrue("Orthogonal vectors 01 and 12",
Math.abs((p[1].x - p[0].x) * (p[2].x - p[1].x) +
(p[1].y - p[0].y) * (p[2].y - p[1].y)) < EPS);
Math.abs((p[1].x - p[0].x) * (p[2].x - p[1].x) +
(p[1].y - p[0].y) * (p[2].y - p[1].y)) < EPS);
assertTrue("Orthogonal vectors 12 and 23",
Math.abs((p[2].x - p[1].x) * (p[3].x - p[2].x) +
(p[2].y - p[1].y) * (p[3].y - p[2].y)) < EPS);
Math.abs((p[2].x - p[1].x) * (p[3].x - p[2].x) +
(p[2].y - p[1].y) * (p[3].y - p[2].y)) < EPS);
assertTrue("Orthogonal vectors 23 and 30",
Math.abs((p[3].x - p[2].x) * (p[0].x - p[3].x) +
(p[3].y - p[2].y) * (p[0].y - p[3].y)) < EPS);
Math.abs((p[3].x - p[2].x) * (p[0].x - p[3].x) +
(p[3].y - p[2].y) * (p[0].y - p[3].y)) < EPS);
assertTrue("Orthogonal vectors 30 and 01",
Math.abs((p[0].x - p[3].x) * (p[1].x - p[0].x) +
(p[0].y - p[3].y) * (p[1].y - p[0].y)) < EPS);
Math.abs((p[0].x - p[3].x) * (p[1].x - p[0].x) +
(p[0].y - p[3].y) * (p[1].y - p[0].y)) < EPS);
assertTrue("Length of the vector 01",
Math.abs((p[1].x - p[0].x) * (p[1].x - p[0].x) +
(p[1].y - p[0].y) * (p[1].y - p[0].y) - size.height * size.height) < EPS);
Math.abs((p[1].x - p[0].x) * (p[1].x - p[0].x) +
(p[1].y - p[0].y) * (p[1].y - p[0].y) - size.height * size.height) < EPS);
assertTrue("Length of the vector 21",
Math.abs((p[1].x - p[2].x) * (p[1].x - p[2].x) +
(p[1].y - p[2].y) * (p[1].y - p[2].y) - size.width * size.width) < EPS);
Math.abs((p[1].x - p[2].x) * (p[1].x - p[2].x) +
(p[1].y - p[2].y) * (p[1].y - p[2].y) - size.width * size.width) < EPS);
assertTrue("Angle of the vector 21 with the axes", Math.abs((p[2].x - p[1].x) / size.width - Math.cos(angle * Math.PI / 180)) < EPS);
}
......@@ -141,7 +142,7 @@ public class RotatedRectTest extends OpenCVTestCase {
}
public void testRotatedRectDoubleArray() {
double[] vals = {1.5, 2.6, 3.7, 4.2, 5.1};
double[] vals = { 1.5, 2.6, 3.7, 4.2, 5.1 };
RotatedRect rr = new RotatedRect(vals);
assertNotNull(rr);
......@@ -161,4 +162,8 @@ public class RotatedRectTest extends OpenCVTestCase {
assertTrue(rr.angle == 40.0);
}
public void testSet() {
fail("Not yet implemented");
}
}
......@@ -5,16 +5,16 @@ import org.opencv.test.OpenCVTestCase;
public class ScalarTest extends OpenCVTestCase {
private Scalar dstScalar;
private Scalar s1;
private Scalar s2;
private Scalar dstScalar;
@Override
protected void setUp() throws Exception {
super.setUp();
s1 = new Scalar(1.0);
s2 = Scalar.all(1.0);
s2 = Scalar.all(1.0);
dstScalar = null;
}
......@@ -42,6 +42,10 @@ public class ScalarTest extends OpenCVTestCase {
assertFalse(s2.equals(s1));
}
public void testHashCode() {
assertEquals(s2.hashCode(), s2.hashCode());
}
public void testIsReal() {
assertTrue(s1.isReal());
......@@ -68,8 +72,8 @@ public class ScalarTest extends OpenCVTestCase {
public void testScalarDoubleArray() {
double[] vals = { 2.0, 4.0, 5.0, 3.0 };
dstScalar = new Scalar(vals);
Scalar truth = new Scalar(2.0, 4.0, 5.0, 3.0);
Scalar truth = new Scalar(2.0, 4.0, 5.0, 3.0);
assertEquals(truth, dstScalar);
}
......
......@@ -6,14 +6,14 @@ import org.opencv.test.OpenCVTestCase;
public class SizeTest extends OpenCVTestCase {
Size dstSize;
Size sz1;
Size sz2;
Size dstSize;
@Override
protected void setUp() throws Exception {
super.setUp();
sz1 = new Size(10.0, 10.0);
sz2 = new Size(-1, -1);
dstSize = null;
......@@ -36,6 +36,10 @@ public class SizeTest extends OpenCVTestCase {
assertTrue(sz1.equals(sz2));
}
public void testHashCode() {
assertEquals(sz1.hashCode(), sz1.hashCode());
}
public void testSet() {
double[] vals1 = {};
sz2.set(vals1);
......@@ -43,14 +47,14 @@ public class SizeTest extends OpenCVTestCase {
assertEquals(0., sz2.height);
double[] vals2 = { 9, 12 };
sz1 .set(vals2);
sz1.set(vals2);
assertEquals(9., sz1.width);
assertEquals(12., sz1.height);
}
public void testSize() {
dstSize = new Size();
assertNotNull(dstSize);
assertEquals(0., dstSize.width);
assertEquals(0., dstSize.height);
......
......@@ -11,7 +11,7 @@ public class TermCriteriaTest extends OpenCVTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
tc1 = new TermCriteria();
tc2 = new TermCriteria(2, 4, EPS);
}
......@@ -28,6 +28,10 @@ public class TermCriteriaTest extends OpenCVTestCase {
assertTrue(tc2.equals(tc1));
}
public void testHashCode() {
assertEquals(tc2.hashCode(), tc2.hashCode());
}
public void testSet() {
double[] vals1 = {};
tc1.set(vals1);
......@@ -46,7 +50,7 @@ public class TermCriteriaTest extends OpenCVTestCase {
public void testTermCriteria() {
tc1 = new TermCriteria();
assertNotNull(tc1);
assertEquals(0, tc1.type);
assertEquals(0, tc1.maxCount);
......@@ -64,7 +68,7 @@ public class TermCriteriaTest extends OpenCVTestCase {
public void testTermCriteriaIntIntDouble() {
tc1 = new TermCriteria(2, 4, EPS);
assertNotNull(tc2);
assertEquals(2, tc2.type);
assertEquals(4, tc2.maxCount);
......
......@@ -34,7 +34,11 @@ public class BRIEFDescriptorExtractorTest extends OpenCVTestCase {
super.setUp();
}
public void testCompute() {
public void testComputeListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testComputeMatListOfKeyPointMat() {
KeyPoint point = new KeyPoint(55.775577545166016f, 44.224422454833984f, 16, 9.754629f, 8617.863f, 1, -1);
List<KeyPoint> keypoints = Arrays.asList(point);
Mat img = getTestImg();
......
......@@ -23,34 +23,12 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
int matSize;
DMatch[] truth;
protected void setUp() throws Exception {
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE);
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) };
super.setUp();
}
private Mat getTrainImg() {
Mat cross = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.line(cross, new Point(20, matSize / 2), new Point(matSize - 21, matSize / 2), new Scalar(100), 2);
Core.line(cross, new Point(matSize / 2, 20), new Point(matSize / 2, matSize - 21), new Scalar(100), 2);
return cross;
}
private Mat getQueryImg() {
Mat cross = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.line(cross, new Point(30, matSize / 2), new Point(matSize - 31, matSize / 2), new Scalar(100), 3);
Core.line(cross, new Point(matSize / 2, 30), new Point(matSize / 2, matSize - 31), new Scalar(100), 3);
return cross;
private Mat getMaskImg() {
return new Mat(5, 2, CvType.CV_8U, new Scalar(0)) {
{
put(0, 0, 1, 1, 1, 1);
}
};
}
private Mat getQueryDescriptors() {
......@@ -71,6 +49,14 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
return descriptors;
}
private Mat getQueryImg() {
Mat cross = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.line(cross, new Point(30, matSize / 2), new Point(matSize - 31, matSize / 2), new Scalar(100), 3);
Core.line(cross, new Point(matSize / 2, 30), new Point(matSize / 2, matSize - 31), new Scalar(100), 3);
return cross;
}
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));
......@@ -83,12 +69,26 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
return descriptors;
}
private Mat getMaskImg() {
return new Mat(5, 2, CvType.CV_8U, new Scalar(0)) {
{
put(0,0, 1, 1, 1, 1);
}
};
private Mat getTrainImg() {
Mat cross = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.line(cross, new Point(20, matSize / 2), new Point(matSize - 21, matSize / 2), new Scalar(100), 2);
Core.line(cross, new Point(matSize / 2, 20), new Point(matSize / 2, matSize - 21), new Scalar(100), 2);
return cross;
}
protected void setUp() throws Exception {
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE);
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) };
super.setUp();
}
public void testAdd() {
......@@ -104,15 +104,6 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.empty());
}
public void testCloneBoolean() {
matcher.add(Arrays.asList(new Mat()));
DescriptorMatcher cloned = matcher.clone(true);
assertNotNull(cloned);
assertTrue(cloned.empty());
}
public void testClone() {
Mat train = new Mat(1, 1, CvType.CV_8U, new Scalar(123));
Mat truth = train.clone();
......@@ -127,6 +118,15 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
assertMatEqual(truth, descriptors.get(0));
}
public void testCloneBoolean() {
matcher.add(Arrays.asList(new Mat()));
DescriptorMatcher cloned = matcher.clone(true);
assertNotNull(cloned);
assertTrue(cloned.empty());
}
public void testCreate() {
assertNotNull(matcher);
}
......@@ -150,13 +150,49 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.isMaskSupported());
}
public void testMatchMatMatListOfDMatchMat() {
public void testKnnMatchMatListOfListOfDMatchInt() {
fail("Not yet implemented");
}
public void testKnnMatchMatListOfListOfDMatchIntListOfMat() {
fail("Not yet implemented");
}
public void testKnnMatchMatListOfListOfDMatchIntListOfMatBoolean() {
fail("Not yet implemented");
}
public void testKnnMatchMatMatListOfListOfDMatchInt() {
fail("Not yet implemented");
}
public void testKnnMatchMatMatListOfListOfDMatchIntMat() {
fail("Not yet implemented");
}
public void testKnnMatchMatMatListOfListOfDMatchIntMatBoolean() {
fail("Not yet implemented");
}
public void testMatchMatListOfDMatch() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(train));
matcher.match(query, matches);
assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
}
public void testMatchMatListOfDMatchListOfMat() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
Mat mask = getMaskImg();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.match(query, train, matches, mask);
matcher.add(Arrays.asList(train));
matcher.match(query, matches, Arrays.asList(mask));
assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
}
......@@ -165,37 +201,49 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.match(query, train, matches);
assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
// OpenCVTestRunner.Log("matches found: " + matches.size());
// for (DMatch m : matches)
// OpenCVTestRunner.Log(m.toString());
// OpenCVTestRunner.Log("matches found: " + matches.size());
// for (DMatch m : matches)
// OpenCVTestRunner.Log(m.toString());
}
public void testMatchMatListOfDMatchListOfMat() {
public void testMatchMatMatListOfDMatchMat() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
Mat mask = getMaskImg();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(train));
matcher.match(query, matches, Arrays.asList(mask));
matcher.match(query, train, matches, mask);
assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
}
public void testMatchMatListOfDMatch() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(train));
matcher.match(query, matches);
assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
public void testRadiusMatchMatListOfListOfDMatchFloat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfListOfDMatchFloatListOfMat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfListOfDMatchFloatListOfMatBoolean() {
fail("Not yet implemented");
}
public void testRadiusMatchMatMatListOfListOfDMatchFloat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatMatListOfListOfDMatchFloatMat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatMatListOfListOfDMatchFloatMatBoolean() {
fail("Not yet implemented");
}
public void testRead() {
......
......@@ -23,30 +23,24 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
int matSize;
DMatch[] truth;
protected void setUp() throws Exception {
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);
matSize = 100;
truth = new DMatch[] {
new DMatch (0, 0, 0, 51),
new DMatch (1, 2, 0, 42),
new DMatch (2, 1, 0, 40),
new DMatch (3, 3, 0, 53) };
super.setUp();
private Mat getMaskImg() {
return new Mat(4, 4, CvType.CV_8U, new Scalar(0)) {
{
put(0, 0, 1, 1, 1, 1, 1, 1, 1, 1);
}
};
}
private Mat getTrainImg() {
Mat img = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.line(img, new Point(40, 40), new Point(matSize - 40, matSize - 40), new Scalar(0), 8);
return img;
private Mat getQueryDescriptors() {
return getTestDescriptors(getQueryImg());
}
private Mat getQueryImg() {
Mat img = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.line(img, new Point(40, matSize - 40), new Point(matSize - 50, 50), new Scalar(0), 8);
return img;
}
private Mat getTestDescriptors(Mat img) {
List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
Mat descriptors = new Mat();
......@@ -56,24 +50,30 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
detector.detect(img, keypoints);
extractor.compute(img, keypoints, descriptors);
return descriptors;
}
private Mat getQueryDescriptors() {
return getTestDescriptors(getQueryImg());
}
private Mat getTrainDescriptors() {
return getTestDescriptors(getTrainImg());
}
private Mat getMaskImg() {
return new Mat(4, 4, CvType.CV_8U, new Scalar(0)) {
{
put(0, 0, 1, 1, 1, 1, 1, 1, 1, 1);
}
};
private Mat getTrainImg() {
Mat img = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.line(img, new Point(40, 40), new Point(matSize - 40, matSize - 40), new Scalar(0), 8);
return img;
}
protected void setUp() throws Exception {
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);
matSize = 100;
truth = new DMatch[] {
new DMatch(0, 0, 0, 51),
new DMatch(1, 2, 0, 42),
new DMatch(2, 1, 0, 40),
new DMatch(3, 3, 0, 53) };
super.setUp();
}
public void testAdd() {
......@@ -89,15 +89,6 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.empty());
}
public void testCloneBoolean() {
matcher.add(Arrays.asList(new Mat()));
DescriptorMatcher cloned = matcher.clone(true);
assertNotNull(cloned);
assertTrue(cloned.empty());
}
public void testClone() {
Mat train = new Mat(1, 1, CvType.CV_8U, new Scalar(123));
Mat truth = train.clone();
......@@ -112,6 +103,15 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
assertMatEqual(truth, descriptors.get(0));
}
public void testCloneBoolean() {
matcher.add(Arrays.asList(new Mat()));
DescriptorMatcher cloned = matcher.clone(true);
assertNotNull(cloned);
assertTrue(cloned.empty());
}
public void testCreate() {
assertNotNull(matcher);
}
......@@ -135,24 +135,38 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.isMaskSupported());
}
public void testMatchMatMatListOfDMatchMat() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
Mat mask = getMaskImg();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.match(query, train, matches, mask);
public void testKnnMatchMatListOfListOfDMatchInt() {
fail("Not yet implemented");
}
assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
public void testKnnMatchMatListOfListOfDMatchIntListOfMat() {
fail("Not yet implemented");
}
public void testMatchMatMatListOfDMatch() {
public void testKnnMatchMatListOfListOfDMatchIntListOfMatBoolean() {
fail("Not yet implemented");
}
public void testKnnMatchMatMatListOfListOfDMatchInt() {
fail("Not yet implemented");
}
public void testKnnMatchMatMatListOfListOfDMatchIntMat() {
fail("Not yet implemented");
}
public void testKnnMatchMatMatListOfListOfDMatchIntMatBoolean() {
fail("Not yet implemented");
}
public void testMatchMatListOfDMatch() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.match(query, train, matches);
matcher.add(Arrays.asList(train));
matcher.match(query, matches);
assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
}
......@@ -168,17 +182,51 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
}
public void testMatchMatListOfDMatch() {
public void testMatchMatMatListOfDMatch() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(train));
matcher.match(query, matches);
matcher.match(query, train, matches);
assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
}
public void testMatchMatMatListOfDMatchMat() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
Mat mask = getMaskImg();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.match(query, train, matches, mask);
assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
}
public void testRadiusMatchMatListOfListOfDMatchFloat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfListOfDMatchFloatListOfMat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfListOfDMatchFloatListOfMatBoolean() {
fail("Not yet implemented");
}
public void testRadiusMatchMatMatListOfListOfDMatchFloat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatMatListOfListOfDMatchFloatMat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatMatListOfListOfDMatchFloatMatBoolean() {
fail("Not yet implemented");
}
public void testRead() {
String filename = OpenCVTestRunner.getTempFileName("yml");
writeFile(filename, "%YAML:1.0\n");
......
......@@ -23,30 +23,24 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
int matSize;
DMatch[] truth;
protected void setUp() throws Exception {
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMINGLUT);
matSize = 100;
truth = new DMatch[] {
new DMatch (0, 0, 0, 51),
new DMatch (1, 2, 0, 42),
new DMatch (2, 1, 0, 40),
new DMatch (3, 3, 0, 53) };
super.setUp();
private Mat getMaskImg() {
return new Mat(4, 4, CvType.CV_8U, new Scalar(0)) {
{
put(0, 0, 1, 1, 1, 1, 1, 1, 1, 1);
}
};
}
private Mat getTrainImg() {
Mat img = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.line(img, new Point(40, 40), new Point(matSize - 40, matSize - 40), new Scalar(0), 8);
return img;
private Mat getQueryDescriptors() {
return getTestDescriptors(getQueryImg());
}
private Mat getQueryImg() {
Mat img = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.line(img, new Point(40, matSize - 40), new Point(matSize - 50, 50), new Scalar(0), 8);
return img;
}
private Mat getTestDescriptors(Mat img) {
List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
Mat descriptors = new Mat();
......@@ -56,24 +50,30 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
detector.detect(img, keypoints);
extractor.compute(img, keypoints, descriptors);
return descriptors;
}
private Mat getQueryDescriptors() {
return getTestDescriptors(getQueryImg());
}
private Mat getTrainDescriptors() {
return getTestDescriptors(getTrainImg());
}
private Mat getMaskImg() {
return new Mat(4, 4, CvType.CV_8U, new Scalar(0)) {
{
put(0, 0, 1, 1, 1, 1, 1, 1, 1, 1);
}
};
private Mat getTrainImg() {
Mat img = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.line(img, new Point(40, 40), new Point(matSize - 40, matSize - 40), new Scalar(0), 8);
return img;
}
protected void setUp() throws Exception {
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMINGLUT);
matSize = 100;
truth = new DMatch[] {
new DMatch(0, 0, 0, 51),
new DMatch(1, 2, 0, 42),
new DMatch(2, 1, 0, 40),
new DMatch(3, 3, 0, 53) };
super.setUp();
}
public void testAdd() {
......@@ -89,15 +89,6 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.empty());
}
public void testCloneBoolean() {
matcher.add(Arrays.asList(new Mat()));
DescriptorMatcher cloned = matcher.clone(true);
assertNotNull(cloned);
assertTrue(cloned.empty());
}
public void testClone() {
Mat train = new Mat(1, 1, CvType.CV_8U, new Scalar(123));
Mat truth = train.clone();
......@@ -112,6 +103,15 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
assertMatEqual(truth, descriptors.get(0));
}
public void testCloneBoolean() {
matcher.add(Arrays.asList(new Mat()));
DescriptorMatcher cloned = matcher.clone(true);
assertNotNull(cloned);
assertTrue(cloned.empty());
}
public void testCreate() {
assertNotNull(matcher);
}
......@@ -135,28 +135,38 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.isMaskSupported());
}
public void testMatchMatMatListOfDMatchMat() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
Mat mask = getMaskImg();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.match(query, train, matches, mask);
public void testKnnMatchMatListOfListOfDMatchInt() {
fail("Not yet implemented");
}
assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
public void testKnnMatchMatListOfListOfDMatchIntListOfMat() {
fail("Not yet implemented");
}
public void testMatchMatMatListOfDMatch() {
public void testKnnMatchMatListOfListOfDMatchIntListOfMatBoolean() {
fail("Not yet implemented");
}
public void testKnnMatchMatMatListOfListOfDMatchInt() {
fail("Not yet implemented");
}
public void testKnnMatchMatMatListOfListOfDMatchIntMat() {
fail("Not yet implemented");
}
public void testKnnMatchMatMatListOfListOfDMatchIntMatBoolean() {
fail("Not yet implemented");
}
public void testMatchMatListOfDMatch() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.match(query, train, matches);
OpenCVTestRunner.Log("matches found: " + matches.size());
for (DMatch m : matches)
OpenCVTestRunner.Log(m.toString());
matcher.add(Arrays.asList(train));
matcher.match(query, matches);
assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
}
......@@ -172,17 +182,55 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
}
public void testMatchMatListOfDMatch() {
public void testMatchMatMatListOfDMatch() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(train));
matcher.match(query, matches);
matcher.match(query, train, matches);
OpenCVTestRunner.Log("matches found: " + matches.size());
for (DMatch m : matches)
OpenCVTestRunner.Log(m.toString());
assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
}
public void testMatchMatMatListOfDMatchMat() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
Mat mask = getMaskImg();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.match(query, train, matches, mask);
assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
}
public void testRadiusMatchMatListOfListOfDMatchFloat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfListOfDMatchFloatListOfMat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfListOfDMatchFloatListOfMatBoolean() {
fail("Not yet implemented");
}
public void testRadiusMatchMatMatListOfListOfDMatchFloat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatMatListOfListOfDMatchFloatMat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatMatListOfListOfDMatchFloatMatBoolean() {
fail("Not yet implemented");
}
public void testRead() {
String filename = OpenCVTestRunner.getTempFileName("yml");
writeFile(filename, "%YAML:1.0\n");
......
......@@ -23,33 +23,12 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
int matSize;
DMatch[] truth;
protected void setUp() throws Exception {
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_L1);
matSize = 100;
truth = new DMatch[] {
new DMatch(0, 0, 0, 3.175296f),
new DMatch(1, 1, 0, 3.5954158f),
new DMatch(2, 1, 0, 1.2537984f),
new DMatch(3, 1, 0, 3.5761614f),
new DMatch(4, 1, 0, 1.3250958f) };
super.setUp();
}
private Mat getTrainImg() {
Mat cross = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.line(cross, new Point(20, matSize / 2), new Point(matSize - 21, matSize / 2), new Scalar(100), 2);
Core.line(cross, new Point(matSize / 2, 20), new Point(matSize / 2, matSize - 21), new Scalar(100), 2);
return cross;
}
private Mat getQueryImg() {
Mat cross = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.line(cross, new Point(30, matSize / 2), new Point(matSize - 31, matSize / 2), new Scalar(100), 3);
Core.line(cross, new Point(matSize / 2, 30), new Point(matSize / 2, matSize - 31), new Scalar(100), 3);
return cross;
private Mat getMaskImg() {
return new Mat(5, 2, CvType.CV_8U, new Scalar(0)) {
{
put(0, 0, 1, 1, 1, 1);
}
};
}
private Mat getQueryDescriptors() {
......@@ -70,6 +49,14 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
return descriptors;
}
private Mat getQueryImg() {
Mat cross = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.line(cross, new Point(30, matSize / 2), new Point(matSize - 31, matSize / 2), new Scalar(100), 3);
Core.line(cross, new Point(matSize / 2, 30), new Point(matSize / 2, matSize - 31), new Scalar(100), 3);
return cross;
}
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));
......@@ -82,12 +69,25 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
return descriptors;
}
private Mat getMaskImg() {
return new Mat(5, 2, CvType.CV_8U, new Scalar(0)) {
{
put(0,0, 1, 1, 1, 1);
}
};
private Mat getTrainImg() {
Mat cross = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.line(cross, new Point(20, matSize / 2), new Point(matSize - 21, matSize / 2), new Scalar(100), 2);
Core.line(cross, new Point(matSize / 2, 20), new Point(matSize / 2, matSize - 21), new Scalar(100), 2);
return cross;
}
protected void setUp() throws Exception {
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_L1);
matSize = 100;
truth = new DMatch[] {
new DMatch(0, 0, 0, 3.175296f),
new DMatch(1, 1, 0, 3.5954158f),
new DMatch(2, 1, 0, 1.2537984f),
new DMatch(3, 1, 0, 3.5761614f),
new DMatch(4, 1, 0, 1.3250958f) };
super.setUp();
}
public void testAdd() {
......@@ -103,15 +103,6 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.empty());
}
public void testCloneBoolean() {
matcher.add(Arrays.asList(new Mat()));
DescriptorMatcher cloned = matcher.clone(true);
assertNotNull(cloned);
assertTrue(cloned.empty());
}
public void testClone() {
Mat train = new Mat(1, 1, CvType.CV_8U, new Scalar(123));
Mat truth = train.clone();
......@@ -126,6 +117,15 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
assertMatEqual(truth, descriptors.get(0));
}
public void testCloneBoolean() {
matcher.add(Arrays.asList(new Mat()));
DescriptorMatcher cloned = matcher.clone(true);
assertNotNull(cloned);
assertTrue(cloned.empty());
}
public void testCreate() {
assertNotNull(matcher);
}
......@@ -149,24 +149,38 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.isMaskSupported());
}
public void testMatchMatMatListOfDMatchMat() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
Mat mask = getMaskImg();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.match(query, train, matches, mask);
public void testKnnMatchMatListOfListOfDMatchInt() {
fail("Not yet implemented");
}
assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
public void testKnnMatchMatListOfListOfDMatchIntListOfMat() {
fail("Not yet implemented");
}
public void testMatchMatMatListOfDMatch() {
public void testKnnMatchMatListOfListOfDMatchIntListOfMatBoolean() {
fail("Not yet implemented");
}
public void testKnnMatchMatMatListOfListOfDMatchInt() {
fail("Not yet implemented");
}
public void testKnnMatchMatMatListOfListOfDMatchIntMat() {
fail("Not yet implemented");
}
public void testKnnMatchMatMatListOfListOfDMatchIntMatBoolean() {
fail("Not yet implemented");
}
public void testMatchMatListOfDMatch() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.match(query, train, matches);
matcher.add(Arrays.asList(train));
matcher.match(query, matches);
assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
}
......@@ -182,17 +196,51 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
}
public void testMatchMatListOfDMatch() {
public void testMatchMatMatListOfDMatch() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(train));
matcher.match(query, matches);
matcher.match(query, train, matches);
assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
}
public void testMatchMatMatListOfDMatchMat() {
Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors();
Mat mask = getMaskImg();
List<DMatch> matches = new ArrayList<DMatch>();
matcher.match(query, train, matches, mask);
assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
}
public void testRadiusMatchMatListOfListOfDMatchFloat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfListOfDMatchFloatListOfMat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfListOfDMatchFloatListOfMatBoolean() {
fail("Not yet implemented");
}
public void testRadiusMatchMatMatListOfListOfDMatchFloat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatMatListOfListOfDMatchFloatMat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatMatListOfListOfDMatchFloatMatBoolean() {
fail("Not yet implemented");
}
public void testRead() {
String filename = OpenCVTestRunner.getTempFileName("yml");
writeFile(filename, "%YAML:1.0\n");
......
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class DMatchTest extends TestCase {
public void testDMatch() {
fail("Not yet implemented");
}
public void testDMatchIntIntFloat() {
fail("Not yet implemented");
}
public void testDMatchIntIntIntFloat() {
fail("Not yet implemented");
}
public void testLessThan() {
fail("Not yet implemented");
}
public void testToString() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class DynamicFASTFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class DynamicGFTTFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class DynamicHARRISFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class DynamicMSERFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class DynamicORBFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class DynamicSIFTFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class DynamicSTARFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class DynamicSURFFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
......@@ -19,14 +19,11 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase {
FeatureDetector detector;
KeyPoint[] truth;
@Override
protected void setUp() throws Exception {
detector = FeatureDetector.create(FeatureDetector.FAST);
truth = new KeyPoint[] { new KeyPoint(32, 27, 6, -1, 254, 0, -1), new KeyPoint(27, 32, 6, -1, 254, 0, -1), new KeyPoint(73, 68, 6, -1, 254, 0, -1),
new KeyPoint(68, 73, 6, -1, 254, 0, -1) };
super.setUp();
private Mat getMaskImg() {
Mat mask = new Mat(100, 100, CvType.CV_8U, new Scalar(255));
Mat right = mask.submat(0, 100, 50, 100);
right.setTo(new Scalar(0));
return mask;
}
private Mat getTestImg() {
......@@ -35,25 +32,26 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase {
return img;
}
private Mat getMaskImg() {
Mat mask = new Mat(100, 100, CvType.CV_8U, new Scalar(255));
Mat right = mask.submat(0, 100, 50, 100);
right.setTo(new Scalar(0));
return mask;
@Override
protected void setUp() throws Exception {
detector = FeatureDetector.create(FeatureDetector.FAST);
truth = new KeyPoint[] { new KeyPoint(32, 27, 6, -1, 254, 0, -1), new KeyPoint(27, 32, 6, -1, 254, 0, -1), new KeyPoint(73, 68, 6, -1, 254, 0, -1),
new KeyPoint(68, 73, 6, -1, 254, 0, -1) };
super.setUp();
}
public void testCreate() {
assertNotNull(detector);
}
public void testDetectMatListOfKeyPointMat() {
Mat img = getTestImg();
Mat mask = getMaskImg();
List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
detector.detect(img, keypoints, mask);
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
assertListKeyPointEquals(Arrays.asList(truth[0], truth[1]), keypoints, EPS);
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
......@@ -69,6 +67,16 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase {
// OpenCVTestRunner.Log(kp.toString());
}
public void testDetectMatListOfKeyPointMat() {
Mat img = getTestImg();
Mat mask = getMaskImg();
List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
detector.detect(img, keypoints, mask);
assertListKeyPointEquals(Arrays.asList(truth[0], truth[1]), keypoints, EPS);
}
public void testEmpty() {
assertFalse(detector.empty());
}
......
......@@ -19,66 +19,119 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class features2dTest extends OpenCVTestCase {
public class Features2dTest extends OpenCVTestCase {
public void testDrawKeypointsMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testDrawKeypointsMatListOfKeyPointMatScalar() {
fail("Not yet implemented");
}
public void testDrawKeypointsMatListOfKeyPointMatScalarInt() {
fail("Not yet implemented");
}
public void testDrawMatches2MatListOfKeyPointMatListOfKeyPointListOfListOfDMatchMat() {
fail("Not yet implemented");
}
public void testDrawMatches2MatListOfKeyPointMatListOfKeyPointListOfListOfDMatchMatScalar() {
fail("Not yet implemented");
}
public void testDrawMatches2MatListOfKeyPointMatListOfKeyPointListOfListOfDMatchMatScalarScalar() {
fail("Not yet implemented");
}
public void testDrawMatches2MatListOfKeyPointMatListOfKeyPointListOfListOfDMatchMatScalarScalarListOfListOfByte() {
fail("Not yet implemented");
}
public void testDrawMatches2MatListOfKeyPointMatListOfKeyPointListOfListOfDMatchMatScalarScalarListOfListOfByteInt() {
fail("Not yet implemented");
}
public void testDrawMatchesMatListOfKeyPointMatListOfKeyPointListOfDMatchMat() {
fail("Not yet implemented");
}
public void testDrawMatchesMatListOfKeyPointMatListOfKeyPointListOfDMatchMatScalar() {
fail("Not yet implemented");
}
public void testDrawMatchesMatListOfKeyPointMatListOfKeyPointListOfDMatchMatScalarScalar() {
fail("Not yet implemented");
}
public void testDrawMatchesMatListOfKeyPointMatListOfKeyPointListOfDMatchMatScalarScalarListOfByte() {
fail("Not yet implemented");
}
public void testDrawMatchesMatListOfKeyPointMatListOfKeyPointListOfDMatchMatScalarScalarListOfByteInt() {
fail("Not yet implemented");
}
public void testPTOD()
{
String detectorCfg = "%YAML:1.0\nhessianThreshold: 4000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n";
String extractorCfg = "%YAML:1.0\nnOctaves: 4\nnOctaveLayers: 2\nextended: 0\nupright: 0\n";
FeatureDetector detector = FeatureDetector.create(FeatureDetector.SURF);
DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.SURF);
DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE);
String detectorCfgFile = OpenCVTestRunner.getTempFileName("yml");
writeFile(detectorCfgFile, detectorCfg);
detector.read(detectorCfgFile);
String extractorCfgFile = OpenCVTestRunner.getTempFileName("yml");
writeFile(extractorCfgFile, extractorCfg);
extractor.read(extractorCfgFile);
Mat imgTrain = Highgui.imread(OpenCVTestRunner.LENA_PATH, Highgui.CV_LOAD_IMAGE_GRAYSCALE);
Mat imgQuery = imgTrain.submat(new Range(0, imgTrain.rows()-100), Range.all());
Mat imgQuery = imgTrain.submat(new Range(0, imgTrain.rows() - 100), Range.all());
List<KeyPoint> trainKeypoints = new ArrayList<KeyPoint>();
List<KeyPoint> queryKeypoints = new ArrayList<KeyPoint>();
detector.detect(imgTrain, trainKeypoints);
detector.detect(imgQuery, queryKeypoints);
//OpenCVTestRunner.Log("Keypoints found: " + trainKeypoints.size() + ":" + queryKeypoints.size());
// OpenCVTestRunner.Log("Keypoints found: " + trainKeypoints.size() +
// ":" + queryKeypoints.size());
Mat trainDescriptors = new Mat();
Mat queryDescriptors = new Mat();
extractor.compute(imgTrain, trainKeypoints, trainDescriptors);
extractor.compute(imgQuery, queryKeypoints, queryDescriptors);
List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(trainDescriptors));
matcher.match(queryDescriptors, matches);
//OpenCVTestRunner.Log("Matches found: " + matches.size());
// OpenCVTestRunner.Log("Matches found: " + matches.size());
List<Point> points1 = new ArrayList<Point>();
List<Point> points2 = new ArrayList<Point>();
for(int i = 0; i < matches.size(); i++){
for (int i = 0; i < matches.size(); i++) {
DMatch match = matches.get(i);
points1.add(trainKeypoints.get(match.trainIdx).pt);
points2.add(queryKeypoints.get(match.queryIdx).pt);
}
Mat hmg = Calib3d.findHomography(points1, points2, Calib3d.RANSAC);
assertMatEqual(Mat.eye(3, 3, CvType.CV_64F), hmg, EPS);
Mat outimg = new Mat();
Features2d.drawMatches(imgQuery, queryKeypoints, imgTrain, trainKeypoints, matches, outimg);
String outputPath = OpenCVTestRunner.getOutputFileName("PTODresult.png");
Highgui.imwrite(outputPath, outimg);
//OpenCVTestRunner.Log("Output image is saved to: " + outputPath);
// OpenCVTestRunner.Log("Output image is saved to: " + outputPath);
}
}
package org.opencv.test.features2d;
import org.opencv.test.OpenCVTestCase;
public class FernGenericDescriptorMatcherTest extends OpenCVTestCase {
public void testAdd() {
fail("Not yet implemented");
}
public void testClassifyMatListOfKeyPointMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testClassifyMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testClear() {
fail("Not yet implemented");
}
public void testCloneBoolean() {
fail("Not yet implemented");
}
public void testClone() {
fail("Not yet implemented");
}
public void testCreate() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testGetTrainImages() {
fail("Not yet implemented");
}
public void testGetTrainKeypoints() {
fail("Not yet implemented");
}
public void testIsMaskSupported() {
fail("Not yet implemented");
}
public void testKnnMatchMatListOfKeyPointMatListOfKeyPointListOfListOfDMatchIntMatBoolean() {
fail("Not yet implemented");
}
public void testKnnMatchMatListOfKeyPointMatListOfKeyPointListOfListOfDMatchIntMat() {
fail("Not yet implemented");
}
public void testKnnMatchMatListOfKeyPointMatListOfKeyPointListOfListOfDMatchInt() {
fail("Not yet implemented");
}
public void testKnnMatchMatListOfKeyPointListOfListOfDMatchIntListOfMatBoolean() {
fail("Not yet implemented");
}
public void testKnnMatchMatListOfKeyPointListOfListOfDMatchIntListOfMat() {
fail("Not yet implemented");
}
public void testKnnMatchMatListOfKeyPointListOfListOfDMatchInt() {
fail("Not yet implemented");
}
public void testMatchMatListOfKeyPointMatListOfKeyPointListOfDMatchMat() {
fail("Not yet implemented");
}
public void testMatchMatListOfKeyPointMatListOfKeyPointListOfDMatch() {
fail("Not yet implemented");
}
public void testMatchMatListOfKeyPointListOfDMatchListOfMat() {
fail("Not yet implemented");
}
public void testMatchMatListOfKeyPointListOfDMatch() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfKeyPointMatListOfKeyPointListOfListOfDMatchFloatMatBoolean() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfKeyPointMatListOfKeyPointListOfListOfDMatchFloatMat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfKeyPointMatListOfKeyPointListOfListOfDMatchFloat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfKeyPointListOfListOfDMatchFloatListOfMatBoolean() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfKeyPointListOfListOfDMatchFloatListOfMat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfKeyPointListOfListOfDMatchFloat() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testTrain() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class GFTTFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class GridFASTFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class GridGFTTFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class GridHARRISFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class GridMSERFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class GridORBFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class GridSIFTFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class GridSTARFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class GridSURFFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class HARRISFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
......@@ -20,10 +20,6 @@ public class KeyPointTest extends OpenCVTestCase {
size = 3.0f;
}
public void test_1() {
super.test_1("features2d.KeyPoint");
}
public void testGet_angle() {
fail("Not yet implemented");
}
......@@ -102,4 +98,8 @@ public class KeyPointTest extends OpenCVTestCase {
fail("Not yet implemented");
}
public void testToString() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class MSERFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
......@@ -34,7 +34,11 @@ public class ORBDescriptorExtractorTest extends OpenCVTestCase {
super.setUp();
}
public void testCompute() {
public void testComputeListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testComputeMatListOfKeyPointMat() {
KeyPoint point = new KeyPoint(55.775577545166016f, 44.224422454833984f, 16, 9.754629f, 8617.863f, 1, -1);
List<KeyPoint> keypoints = Arrays.asList(point);
Mat img = getTestImg();
......@@ -72,17 +76,17 @@ public class ORBDescriptorExtractorTest extends OpenCVTestCase {
List<KeyPoint> keypoints = Arrays.asList(point);
Mat img = getTestImg();
Mat descriptors = new Mat();
String filename = OpenCVTestRunner.getTempFileName("yml");
writeFile(filename, "%YAML:1.0\nscaleFactor: 1.1\nnLevels: 3\nfirstLevel: 0\nedgeThreshold: 31\npatchSize: 31\n");
extractor.read(filename);
extractor.compute(img, keypoints, 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);
252, 119, 191, 4, 2, 66, 1, 66, 145);
}
};
assertMatEqual(truth, descriptors);
......
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class ORBFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import org.opencv.test.OpenCVTestCase;
public class OneWayGenericDescriptorMatcherTest extends OpenCVTestCase {
public void testAdd() {
fail("Not yet implemented");
}
public void testClassifyMatListOfKeyPointMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testClassifyMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testClear() {
fail("Not yet implemented");
}
public void testCloneBoolean() {
fail("Not yet implemented");
}
public void testClone() {
fail("Not yet implemented");
}
public void testCreate() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testGetTrainImages() {
fail("Not yet implemented");
}
public void testGetTrainKeypoints() {
fail("Not yet implemented");
}
public void testIsMaskSupported() {
fail("Not yet implemented");
}
public void testKnnMatchMatListOfKeyPointMatListOfKeyPointListOfListOfDMatchIntMatBoolean() {
fail("Not yet implemented");
}
public void testKnnMatchMatListOfKeyPointMatListOfKeyPointListOfListOfDMatchIntMat() {
fail("Not yet implemented");
}
public void testKnnMatchMatListOfKeyPointMatListOfKeyPointListOfListOfDMatchInt() {
fail("Not yet implemented");
}
public void testKnnMatchMatListOfKeyPointListOfListOfDMatchIntListOfMatBoolean() {
fail("Not yet implemented");
}
public void testKnnMatchMatListOfKeyPointListOfListOfDMatchIntListOfMat() {
fail("Not yet implemented");
}
public void testKnnMatchMatListOfKeyPointListOfListOfDMatchInt() {
fail("Not yet implemented");
}
public void testMatchMatListOfKeyPointMatListOfKeyPointListOfDMatchMat() {
fail("Not yet implemented");
}
public void testMatchMatListOfKeyPointMatListOfKeyPointListOfDMatch() {
fail("Not yet implemented");
}
public void testMatchMatListOfKeyPointListOfDMatchListOfMat() {
fail("Not yet implemented");
}
public void testMatchMatListOfKeyPointListOfDMatch() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfKeyPointMatListOfKeyPointListOfListOfDMatchFloatMatBoolean() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfKeyPointMatListOfKeyPointListOfListOfDMatchFloatMat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfKeyPointMatListOfKeyPointListOfListOfDMatchFloat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfKeyPointListOfListOfDMatchFloatListOfMatBoolean() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfKeyPointListOfListOfDMatchFloatListOfMat() {
fail("Not yet implemented");
}
public void testRadiusMatchMatListOfKeyPointListOfListOfDMatchFloat() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testTrain() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class OpponentBRIEFDescriptorExtractorTest extends TestCase {
public void testComputeListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testComputeMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testCreate() {
fail("Not yet implemented");
}
public void testDescriptorSize() {
fail("Not yet implemented");
}
public void testDescriptorType() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class OpponentORBDescriptorExtractorTest extends TestCase {
public void testComputeListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testComputeMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testCreate() {
fail("Not yet implemented");
}
public void testDescriptorSize() {
fail("Not yet implemented");
}
public void testDescriptorType() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class OpponentSIFTDescriptorExtractorTest extends TestCase {
public void testComputeListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testComputeMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testCreate() {
fail("Not yet implemented");
}
public void testDescriptorSize() {
fail("Not yet implemented");
}
public void testDescriptorType() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class OpponentSURFDescriptorExtractorTest extends TestCase {
public void testComputeListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testComputeMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testCreate() {
fail("Not yet implemented");
}
public void testDescriptorSize() {
fail("Not yet implemented");
}
public void testDescriptorType() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class PyramidFASTFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class PyramidGFTTFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class PyramidHARRISFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class PyramidMSERFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class PyramidORBFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class PyramidSIFTFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class PyramidSTARFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class PyramidSURFFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
......@@ -17,8 +17,8 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase {
DescriptorExtractor extractor;
KeyPoint keypoint;
Mat truth;
int matSize;
Mat truth;
private Mat getTestImg() {
Mat cross = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
......@@ -35,7 +35,7 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase {
matSize = 100;
truth = new Mat(1, 128, CvType.CV_32FC1) {
{
put(0,0, 123, 0, 0, 1, 123, 0, 0, 1, 123, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
put(0, 0, 123, 0, 0, 1, 123, 0, 0, 1, 123, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 123, 0, 0, 2, 123, 0, 0, 2, 123, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 30,
7, 31, 123, 0, 0, 0, 123, 52, 88, 0, 0, 0, 0, 0, 0, 2, 123, 0, 0, 0, 0, 0, 0, 1, 110, 0, 0, 0, 0, 0, 18, 37, 18, 34, 16,
21, 12, 23, 12, 50, 123, 0, 0, 0, 90, 26, 0, 3, 123, 0, 0, 1, 122, 0, 0, 2, 123, 0, 0, 1, 93, 0);
......@@ -45,7 +45,11 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase {
super.setUp();
}
public void testCompute() {
public void testComputeListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testComputeMatListOfKeyPointMat() {
List<KeyPoint> keypoints = Arrays.asList(keypoint);
Mat img = getTestImg();
Mat descriptors = new Mat();
......@@ -77,7 +81,8 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase {
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");
writeFile(filename,
"%YAML:1.0\nmagnification: 3.\nisNormalize: 1\nrecalculateAngles: 1\nnOctaves: 6\nnOctaveLayers: 4\nfirstOctave: -1\nangleMode: 0\n");
extractor.read(filename);
......
package org.opencv.test.features2d;
import junit.framework.TestCase;
public class SIFTFeatureDetectorTest extends TestCase {
public void testCreate() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testRead() {
fail("Not yet implemented");
}
public void testWrite() {
fail("Not yet implemented");
}
}
......@@ -17,8 +17,30 @@ import java.util.List;
public class STARFeatureDetectorTest extends OpenCVTestCase {
FeatureDetector detector;
KeyPoint[] truth;
int matSize;
KeyPoint[] truth;
private Mat getMaskImg() {
Mat mask = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Mat right = mask.submat(0, matSize, matSize / 2, matSize);
right.setTo(new Scalar(0));
return mask;
}
private Mat getTestImg() {
Scalar color = new Scalar(0);
int center = matSize / 2;
int radius = 6;
int offset = 40;
Mat img = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.circle(img, new Point(center - offset, center), radius, color, -1);
Core.circle(img, new Point(center + offset, center), radius, color, -1);
Core.circle(img, new Point(center, center - offset), radius, color, -1);
Core.circle(img, new Point(center, center + offset), radius, color, -1);
Core.circle(img, new Point(center, center), radius, color, -1);
return img;
}
protected void setUp() throws Exception {
detector = FeatureDetector.create(FeatureDetector.STAR);
......@@ -39,49 +61,35 @@ public class STARFeatureDetectorTest extends OpenCVTestCase {
super.setUp();
}
private Mat getTestImg() {
Scalar color = new Scalar(0);
int center = matSize / 2;
int radius = 6;
int offset = 40;
Mat img = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Core.circle(img, new Point(center - offset, center), radius, color, -1);
Core.circle(img, new Point(center + offset, center), radius, color, -1);
Core.circle(img, new Point(center, center - offset), radius, color, -1);
Core.circle(img, new Point(center, center + offset), radius, color, -1);
Core.circle(img, new Point(center, center), radius, color, -1);
return img;
public void testCreate() {
assertNotNull(detector);
}
private Mat getMaskImg() {
Mat mask = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Mat right = mask.submat(0, matSize, matSize / 2, matSize);
right.setTo(new Scalar(0));
return mask;
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testCreate() {
assertNotNull(detector);
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPointMat() {
public void testDetectMatListOfKeyPoint() {
Mat img = getTestImg();
Mat mask = getMaskImg();
List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
detector.detect(img, keypoints, mask);
detector.detect(img, keypoints);
assertListKeyPointEquals(Arrays.asList(truth[0], truth[2], truth[5], truth[7]), keypoints, EPS);
assertListKeyPointEquals(Arrays.asList(truth), keypoints, EPS);
}
public void testDetectMatListOfKeyPoint() {
public void testDetectMatListOfKeyPointMat() {
Mat img = getTestImg();
Mat mask = getMaskImg();
List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
detector.detect(img, keypoints);
detector.detect(img, keypoints, mask);
assertListKeyPointEquals(Arrays.asList(truth), keypoints, EPS);
assertListKeyPointEquals(Arrays.asList(truth[0], truth[2], truth[5], truth[7]), keypoints, EPS);
}
public void testEmpty() {
......@@ -90,17 +98,17 @@ public class STARFeatureDetectorTest extends OpenCVTestCase {
public void testRead() {
Mat img = getTestImg();
List<KeyPoint> keypoints1 = new ArrayList<KeyPoint>();
detector.detect(img, keypoints1);
String filename = OpenCVTestRunner.getTempFileName("yml");
writeFile(filename, "%YAML:1.0\nmaxSize: 45\nresponseThreshold: 150\nlineThresholdProjected: 10\nlineThresholdBinarized: 8\nsuppressNonmaxSize: 5\n");
detector.read(filename);
List<KeyPoint> keypoints2 = new ArrayList<KeyPoint>();
detector.detect(img, keypoints2);
assertTrue(keypoints2.size() <= keypoints1.size());
}
......
......@@ -34,7 +34,11 @@ public class SURFDescriptorExtractorTest extends OpenCVTestCase {
super.setUp();
}
public void testCompute() {
public void testComputeListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testComputeMatListOfKeyPointMat() {
KeyPoint point = new KeyPoint(55.775577545166016f, 44.224422454833984f, 16, 9.754629f, 8617.863f, 1, -1);
List<KeyPoint> keypoints = Arrays.asList(point);
Mat img = getTestImg();
......
......@@ -17,23 +17,16 @@ import java.util.Comparator;
import java.util.List;
public class SURFFeatureDetectorTest extends OpenCVTestCase {
FeatureDetector detector;
KeyPoint[] truth;
int matSize;
KeyPoint[] truth;
@Override
protected void setUp() throws Exception {
detector = FeatureDetector.create(FeatureDetector.SURF);
matSize = 100;
truth = new KeyPoint[] { new KeyPoint(55.775577545166016f, 44.224422454833984f, 16, 9.754629f, 8617.863f, 1, -1),
new KeyPoint(44.224422454833984f, 44.224422454833984f, 16, 99.75463f, 8617.863f, 1, -1),
new KeyPoint(44.224422454833984f, 55.775577545166016f, 16, 189.7546f, 8617.863f, 1, -1),
new KeyPoint(55.775577545166016f, 55.775577545166016f, 16, 279.75464f, 8617.863f, 1, -1) };
super.setUp();
private Mat getMaskImg() {
Mat mask = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Mat right = mask.submat(0, matSize, matSize / 2, matSize);
right.setTo(new Scalar(0));
return mask;
}
private Mat getTestImg() {
......@@ -56,37 +49,55 @@ public class SURFFeatureDetectorTest extends OpenCVTestCase {
});
}
private Mat getMaskImg() {
Mat mask = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
Mat right = mask.submat(0, matSize, matSize / 2, matSize);
right.setTo(new Scalar(0));
return mask;
@Override
protected void setUp() throws Exception {
detector = FeatureDetector.create(FeatureDetector.SURF);
matSize = 100;
truth = new KeyPoint[] { new KeyPoint(55.775577545166016f, 44.224422454833984f, 16, 9.754629f, 8617.863f, 1, -1),
new KeyPoint(44.224422454833984f, 44.224422454833984f, 16, 99.75463f, 8617.863f, 1, -1),
new KeyPoint(44.224422454833984f, 55.775577545166016f, 16, 189.7546f, 8617.863f, 1, -1),
new KeyPoint(55.775577545166016f, 55.775577545166016f, 16, 279.75464f, 8617.863f, 1, -1) };
super.setUp();
}
public void testCreate() {
assertNotNull(detector);
}
public void testDetectMatListOfKeyPointMat() {
public void testDetectListOfMatListOfListOfKeyPoint() {
String filename = OpenCVTestRunner.getTempFileName("yml");
writeFile(filename, "%YAML:1.0\nhessianThreshold: 8000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n");
detector.read(filename);
Mat img = getTestImg();
Mat mask = getMaskImg();
List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
detector.detect(img, keypoints, mask);
order(keypoints);
assertListKeyPointEquals(Arrays.asList(truth[1], truth[2]), keypoints, EPS);
List<List<KeyPoint>> keypoints = new ArrayList<List<KeyPoint>>();
Mat cross = getTestImg();
List<Mat> crosses = new ArrayList<Mat>(3);
crosses.add(cross);
crosses.add(cross);
crosses.add(cross);
detector.detect(crosses, keypoints);
assertEquals(3, keypoints.size());
for (List<KeyPoint> lkp : keypoints) {
order(lkp);
assertListKeyPointEquals(Arrays.asList(truth), lkp, EPS);
}
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
String filename = OpenCVTestRunner.getTempFileName("yml");
writeFile(filename, "%YAML:1.0\nhessianThreshold: 8000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n");
detector.read(filename);
List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
Mat cross = getTestImg();
......@@ -96,27 +107,20 @@ public class SURFFeatureDetectorTest extends OpenCVTestCase {
assertListKeyPointEquals(Arrays.asList(truth), keypoints, EPS);
}
public void testDetectListOfMatListOfListOfKeyPoint() {
public void testDetectMatListOfKeyPointMat() {
String filename = OpenCVTestRunner.getTempFileName("yml");
writeFile(filename, "%YAML:1.0\nhessianThreshold: 8000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n");
detector.read(filename);
List<List<KeyPoint>> keypoints = new ArrayList<List<KeyPoint>>();
Mat cross = getTestImg();
List<Mat> crosses = new ArrayList<Mat>(3);
crosses.add(cross);
crosses.add(cross);
crosses.add(cross);
detector.detect(crosses, keypoints);
assertEquals(3, keypoints.size());
Mat img = getTestImg();
Mat mask = getMaskImg();
List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
for(List<KeyPoint> lkp : keypoints) {
order(lkp);
assertListKeyPointEquals(Arrays.asList(truth), lkp, EPS);
}
}
detector.detect(img, keypoints, mask);
order(keypoints);
assertListKeyPointEquals(Arrays.asList(truth[1], truth[2]), keypoints, EPS);
}
public void testEmpty() {
assertFalse(detector.empty());
......@@ -124,17 +128,17 @@ public class SURFFeatureDetectorTest extends OpenCVTestCase {
public void testRead() {
Mat cross = getTestImg();
List<KeyPoint> keypoints1 = new ArrayList<KeyPoint>();
detector.detect(cross, keypoints1);
String filename = OpenCVTestRunner.getTempFileName("yml");
writeFile(filename, "%YAML:1.0\nhessianThreshold: 8000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n");
detector.read(filename);
List<KeyPoint> keypoints2 = new ArrayList<KeyPoint>();
detector.detect(cross, keypoints2);
assertTrue(keypoints2.size() <= keypoints1.size());
}
......
......@@ -4,7 +4,19 @@ import org.opencv.highgui.Highgui;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
public class highguiTest extends OpenCVTestCase {
public class HighguiTest extends OpenCVTestCase {
public void testImdecode() {
fail("Not yet implemented");
}
public void testImencodeStringMatListOfByte() {
fail("Not yet implemented");
}
public void testImencodeStringMatListOfByteListOfInteger() {
fail("Not yet implemented");
}
public void testImreadString() {
dst = Highgui.imread(OpenCVTestRunner.LENA_PATH);
......@@ -22,4 +34,12 @@ public class highguiTest extends OpenCVTestCase {
assertTrue(512 == dst.rows());
}
public void testImwriteStringMat() {
fail("Not yet implemented");
}
public void testImwriteStringMatListOfInteger() {
fail("Not yet implemented");
}
}
package org.opencv.test.highgui;
import java.util.List;
import org.opencv.core.Size;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;
......@@ -8,8 +11,8 @@ import org.opencv.test.OpenCVTestCase;
public class VideoCaptureTest extends OpenCVTestCase {
private VideoCapture capture;
private boolean isSucceed;
private boolean isOpened;
private boolean isSucceed;
@Override
protected void setUp() throws Exception {
......@@ -20,15 +23,27 @@ public class VideoCaptureTest extends OpenCVTestCase {
isOpened = false;
}
public void test_1() {
super.test_1("HIGHGUI.VideoCapture");
public void testGet() {
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
double frameWidth = capture.get(Highgui.CV_CAP_PROP_FRAME_WIDTH);
assertTrue(0 != frameWidth);
} finally {
if (capture != null) capture.release();
}
}
public void testGet() {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
double frameWidth = capture.get(Highgui.CV_CAP_PROP_FRAME_WIDTH);
capture.release();
assertTrue(0 != frameWidth);
public void testGetSupportedPreviewSizes() {
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
List<Size> sizes = capture.getSupportedPreviewSizes();
assertNotNull(sizes);
assertFalse(sizes.isEmpty());
} finally {
if (capture != null) capture.release();
}
}
public void testGrab() {
......@@ -38,10 +53,13 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public void testGrabFromRealCamera() {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
isSucceed = capture.grab();
capture.release();
assertTrue(isSucceed);
try {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
isSucceed = capture.grab();
assertTrue(isSucceed);
} finally {
if (capture != null) capture.release();
}
}
public void testIsOpened() {
......@@ -50,76 +68,110 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public void testIsOpenedRealCamera() {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
isOpened = capture.isOpened();
capture.release();
assertTrue(isOpened);
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
isOpened = capture.isOpened();
assertTrue(isOpened);
} finally {
if (capture != null) capture.release();
}
}
public void testOpen() {
capture = new VideoCapture();
capture.open(Highgui.CV_CAP_ANDROID);
isOpened = capture.isOpened();
capture.release();
assertTrue(isOpened);
try
{
capture = new VideoCapture();
capture.open(Highgui.CV_CAP_ANDROID);
isOpened = capture.isOpened();
assertTrue(isOpened);
} finally {
if (capture != null) capture.release();
}
}
public void testRead() {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
isSucceed = capture.read(dst);
capture.release();
assertTrue(isSucceed);
assertFalse(dst.empty());
assertEquals(3, dst.channels());
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
isSucceed = capture.read(dst);
assertTrue(isSucceed);
assertFalse(dst.empty());
assertEquals(3, dst.channels());
} finally {
if (capture != null) capture.release();
}
}
public void testRelease() {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.release();
assertFalse(capture.isOpened());
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.release();
assertFalse(capture.isOpened());
capture = null;
} finally {
if (capture != null) capture.release();
}
}
public void testRetrieveMat() {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.grab();
isSucceed = capture.retrieve(dst);
capture.release();
assertTrue(isSucceed);
assertFalse(dst.empty());
assertEquals(3, dst.channels());
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.grab();
isSucceed = capture.retrieve(dst);
assertTrue(isSucceed);
assertFalse(dst.empty());
assertEquals(3, dst.channels());
} finally {
if (capture != null) capture.release();
}
}
public void testRetrieveMatInt() {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.grab();
isSucceed = capture.retrieve(dst, 1);
capture.release();
assertTrue(isSucceed);
assertFalse(dst.empty());
// OpenCVTestRunner.Log(dst.toString());
assertEquals(1, dst.channels());
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.grab();
isSucceed = capture.retrieve(dst, Highgui.CV_CAP_ANDROID_GREY_FRAME);
assertTrue(isSucceed);
assertFalse(dst.empty());
assertEquals(1, dst.channels());
} finally {
if (capture != null) capture.release();
}
}
public void testSet() {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, 640.0);
double frameWidth = capture.get(Highgui.CV_CAP_PROP_FRAME_WIDTH);
capture.read(dst);
capture.release();
assertEquals(640.0, frameWidth);
assertEquals(640, dst.cols());
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, 640);
capture.set(Highgui.CV_CAP_PROP_FRAME_HEIGHT, 480);
double frameWidth = capture.get(Highgui.CV_CAP_PROP_FRAME_WIDTH);
capture.read(dst);
assertEquals(640.0, frameWidth);
assertEquals(640, dst.cols());
} finally {
if (capture != null) capture.release();
}
}
public void testVideoCapture() {
capture = new VideoCapture();
assertTrue(null != capture);
assertNotNull(capture);
assertFalse(capture.isOpened());
}
public void testVideoCaptureInt() {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
assertTrue(null != capture);
isOpened = capture.isOpened();
capture.release();
assertTrue(isOpened);
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
assertNotNull(capture);
assertTrue(capture.isOpened());
} finally {
if (capture != null) capture.release();
}
}
}
......@@ -4,10 +4,6 @@ import org.opencv.test.OpenCVTestCase;
public class MomentsTest extends OpenCVTestCase {
protected void setUp() throws Exception {
super.setUp();
}
public void testGet_m00() {
fail("Not yet implemented");
}
......
package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase;
public class CvBoostParamsTest extends OpenCVTestCase {
protected void setUp() throws Exception {
super.setUp();
}
public void testGet_boost_type() {
fail("Not yet implemented");
}
public void testGet_split_criteria() {
fail("Not yet implemented");
}
public void testGet_weak_count() {
fail("Not yet implemented");
}
public void testGet_weight_trim_rate() {
fail("Not yet implemented");
}
public void testSet_boost_type() {
fail("Not yet implemented");
}
public void testSet_split_criteria() {
fail("Not yet implemented");
}
public void testSet_weak_count() {
fail("Not yet implemented");
}
public void testSet_weight_trim_rate() {
fail("Not yet implemented");
}
}
package org.opencv.test.ml;
import org.opencv.ml.CvBoostParams;
import junit.framework.TestCase;
public class CvBoostParamsTest extends TestCase {
public void testCvBoostParams() {
new CvBoostParams();
}
public void testGet_boost_type() {
fail("Not yet implemented");
}
public void testGet_split_criteria() {
fail("Not yet implemented");
}
public void testGet_weak_count() {
fail("Not yet implemented");
}
public void testGet_weight_trim_rate() {
fail("Not yet implemented");
}
public void testSet_boost_type() {
fail("Not yet implemented");
}
public void testSet_split_criteria() {
fail("Not yet implemented");
}
public void testSet_weak_count() {
fail("Not yet implemented");
}
public void testSet_weight_trim_rate() {
fail("Not yet implemented");
}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment