Java API: fixed problems in video and ml modules; generated test stubs for all exported functions (now we have 1701 tests).

This commit is contained in:
Andrey Kamaev 2011-08-05 08:39:28 +00:00
parent 9b1cb7227a
commit a0590273e9
98 changed files with 4782 additions and 2214 deletions

View File

@ -1707,7 +1707,7 @@ status(" Documentation:")
status(" Sphinx:" HAVE_SPHINX THEN "${SPHINX_BUILD} (ver ${SPHINX_VERSION})" ELSE NO) status(" Sphinx:" HAVE_SPHINX THEN "${SPHINX_BUILD} (ver ${SPHINX_VERSION})" ELSE NO)
status(" PdfLaTeX compiler:" PDFLATEX_COMPILER THEN "${PDFLATEX_COMPILER}" ELSE NO) status(" PdfLaTeX compiler:" PDFLATEX_COMPILER THEN "${PDFLATEX_COMPILER}" ELSE NO)
if (BUILD_DOCS AND HAVE_SPHINX) 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() else()
status(" Build Documentation:" NO) status(" Build Documentation:" NO)
endif() endif()

View File

@ -1,15 +1,5 @@
package org.opencv.test; 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.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -21,6 +11,16 @@ import java.util.List;
import junit.framework.TestCase; 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 { public class OpenCVTestCase extends TestCase {
protected static int matSize = 10; protected static int matSize = 10;
@ -167,22 +167,28 @@ public class OpenCVTestCase extends TestCase {
super.tearDown(); 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()) { if (list1.size() != list2.size()) {
throw new UnsupportedOperationException(); 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++) for (int i = 0; i < list1.size(); i++)
assertEquals(list1.get(i), list2.get(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()) { if (list1.size() != list2.size()) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
for (int i = 0; i < list1.size(); i++) 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) { public static void assertListMatEquals(List<Mat> list1, List<Mat> list2, double epsilon) {

View File

@ -0,0 +1,23 @@
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");
}
}

View File

@ -13,11 +13,7 @@ import org.opencv.core.Scalar;
import org.opencv.core.Size; import org.opencv.core.Size;
import org.opencv.test.OpenCVTestCase; import org.opencv.test.OpenCVTestCase;
public class calib3dTest extends OpenCVTestCase { public class Calib3dTest extends OpenCVTestCase {
public void test_1() {
super.test_1("calib3d");
}
public void testCalibrateCameraListOfMatListOfMatSizeMatMatListOfMatListOfMat() { public void testCalibrateCameraListOfMatListOfMatSizeMatMatListOfMatListOfMat() {
fail("Not yet implemented"); fail("Not yet implemented");
@ -238,7 +234,7 @@ public class calib3dTest extends OpenCVTestCase {
assertEquals(CvType.CV_32FC2, centers.type()); assertEquals(CvType.CV_32FC2, centers.type());
} }
public void testFindFundamentalMatMatMat() { public void testFindFundamentalMatListOfPointListOfPoint() {
List<Point> pts1 = new ArrayList<Point>(); List<Point> pts1 = new ArrayList<Point>();
List<Point> pts2 = new ArrayList<Point>(); List<Point> pts2 = new ArrayList<Point>();
@ -257,24 +253,23 @@ public class calib3dTest extends OpenCVTestCase {
assertMatEqual(truth, fm, EPS); assertMatEqual(truth, fm, EPS);
} }
public void testFindFundamentalMatMatMatInt() { public void testFindFundamentalMatListOfPointListOfPointInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testFindFundamentalMatMatMatIntDouble() { public void testFindFundamentalMatListOfPointListOfPointIntDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testFindFundamentalMatMatMatIntDoubleDouble() { public void testFindFundamentalMatListOfPointListOfPointIntDoubleDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testFindFundamentalMatMatMatIntDoubleDoubleMat() { public void testFindFundamentalMatListOfPointListOfPointIntDoubleDoubleMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testFindHomographyMatMat() { public void testFindHomographyListOfPointListOfPoint() {
List<Point> originalPoints = new ArrayList<Point>(); List<Point> originalPoints = new ArrayList<Point>();
List<Point> transformedPoints = new ArrayList<Point>(); List<Point> transformedPoints = new ArrayList<Point>();
@ -293,15 +288,15 @@ public class calib3dTest extends OpenCVTestCase {
assertMatEqual(truth, hmg, EPS); assertMatEqual(truth, hmg, EPS);
} }
public void testFindHomographyMatMatInt() { public void testFindHomographyListOfPointListOfPointInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testFindHomographyMatMatIntDouble() { public void testFindHomographyListOfPointListOfPointIntDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testFindHomographyMatMatIntDoubleMat() { public void testFindHomographyListOfPointListOfPointIntDoubleMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -495,7 +490,7 @@ public class calib3dTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSolvePnPMatMatMatMatMatMat() { public void testSolvePnPListOfPoint3ListOfPointMatMatMatMat() {
Mat intrinsics = Mat.eye(3, 3, CvType.CV_32F); Mat intrinsics = Mat.eye(3, 3, CvType.CV_32F);
intrinsics.put(0, 0, 400); intrinsics.put(0, 0, 400);
intrinsics.put(1, 1, 400); intrinsics.put(1, 1, 400);
@ -527,31 +522,31 @@ public class calib3dTest extends OpenCVTestCase {
assertMatEqual(truth_tvec, tvec, EPS); assertMatEqual(truth_tvec, tvec, EPS);
} }
public void testSolvePnPMatMatMatMatMatMatBoolean() { public void testSolvePnPListOfPoint3ListOfPointMatMatMatMatBoolean() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSolvePnPRansacMatMatMatMatMatMat() { public void testSolvePnPRansacListOfPoint3ListOfPointMatMatMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSolvePnPRansacMatMatMatMatMatMatBoolean() { public void testSolvePnPRansacListOfPoint3ListOfPointMatMatMatMatBoolean() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSolvePnPRansacMatMatMatMatMatMatBooleanInt() { public void testSolvePnPRansacListOfPoint3ListOfPointMatMatMatMatBooleanInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloat() { public void testSolvePnPRansacListOfPoint3ListOfPointMatMatMatMatBooleanIntFloat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloatInt() { public void testSolvePnPRansacListOfPoint3ListOfPointMatMatMatMatBooleanIntFloatInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloatIntMat() { public void testSolvePnPRansacListOfPoint3ListOfPointMatMatMatMatBooleanIntFloatIntMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -582,5 +577,4 @@ public class calib3dTest extends OpenCVTestCase {
public void testValidateDisparityMatMatIntIntInt() { public void testValidateDisparityMatMatIntIntInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
} }

View File

@ -4,10 +4,6 @@ import org.opencv.test.OpenCVTestCase;
public class StereoBMTest extends OpenCVTestCase { public class StereoBMTest extends OpenCVTestCase {
protected void setUp() throws Exception {
super.setUp();
}
public void testComputeMatMatMat() { public void testComputeMatMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }

View File

@ -4,10 +4,6 @@ import org.opencv.test.OpenCVTestCase;
public class StereoSGBMTest extends OpenCVTestCase { public class StereoSGBMTest extends OpenCVTestCase {
protected void setUp() throws Exception {
super.setUp();
}
public void testCompute() { public void testCompute() {
fail("Not yet implemented"); fail("Not yet implemented");
} }

View File

@ -13,11 +13,7 @@ import org.opencv.core.Scalar;
import org.opencv.test.OpenCVTestCase; import org.opencv.test.OpenCVTestCase;
import org.opencv.utils.Converters; import org.opencv.utils.Converters;
public class coreTest extends OpenCVTestCase { public class CoreTest extends OpenCVTestCase {
public void test_1() {
super.test_1("CORE");
}
public void testAbsdiff() { public void testAbsdiff() {
Core.absdiff(gray128, gray255, dst); Core.absdiff(gray128, gray255, dst);
@ -167,9 +163,8 @@ public class coreTest extends OpenCVTestCase {
try { try {
Core.checkRange(outOfRange, false); Core.checkRange(outOfRange, false);
fail("Core.checkRange should throw the CvException"); fail("Core.checkRange should throw the CvException");
} catch (Exception e) { } catch (CvException e) {
if (!(e instanceof CvException)) //expected
fail("Core.checkRange should throw the CvException");
} }
} }
@ -223,11 +218,9 @@ public class coreTest extends OpenCVTestCase {
Scalar color0 = new Scalar(0); Scalar color0 = new Scalar(0);
assertTrue(0 == Core.countNonZero(gray0)); assertTrue(0 == Core.countNonZero(gray0));
Core.circle(gray0, center2, radius * 2, color128, 2, 4, 1/* Core.circle(gray0, center2, radius * 2, color128, 2, 4, 1/* Number of
* Number of
* fractional * fractional
* bits * bits */);
*/);
Core.circle(gray0, center, radius, color0, 2, 4, 0); Core.circle(gray0, center, radius, color0, 2, 4, 0);
assertTrue(0 == Core.countNonZero(gray0)); assertTrue(0 == Core.countNonZero(gray0));
} }
@ -613,6 +606,10 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testGetNumberOfCPUs() {
fail("Not yet implemented");
}
public void testGetOptimalDFTSize() { public void testGetOptimalDFTSize() {
int vecsize = Core.getOptimalDFTSize(0); int vecsize = Core.getOptimalDFTSize(0);
assertEquals(1, vecsize); assertEquals(1, vecsize);

View File

@ -0,0 +1,63 @@
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)));
}
}

View File

@ -1,5 +1,7 @@
package org.opencv.test.core; package org.opencv.test.core;
import java.util.Arrays;
import org.opencv.core.CvType; import org.opencv.core.CvType;
import org.opencv.core.Mat; import org.opencv.core.Mat;
import org.opencv.core.Scalar; import org.opencv.core.Scalar;
@ -7,8 +9,16 @@ import org.opencv.test.OpenCVTestCase;
public class MatTest extends OpenCVTestCase { public class MatTest extends OpenCVTestCase {
public void test_1() { public void testAdjustROI() {
super.test_1("Mat"); fail("Not yet implemented");
}
public void testAssignToMat() {
fail("Not yet implemented");
}
public void testAssignToMatInt() {
fail("Not yet implemented");
} }
public void testChannels() { public void testChannels() {
@ -17,9 +27,23 @@ public class MatTest extends OpenCVTestCase {
assertEquals(4, rgba0.channels()); 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() { public void testClone() {
dst = gray0.clone(); dst = gray0.clone();
assertMatEqual(gray0, dst); assertMatEqual(gray0, dst);
assertFalse(gray0.getNativeObjAddr() == dst.getNativeObjAddr());
assertFalse(gray0.dataAddr() == dst.dataAddr());
} }
public void testCol() { public void testCol() {
@ -28,14 +52,30 @@ public class MatTest extends OpenCVTestCase {
assertEquals(gray0.rows(), col.rows()); assertEquals(gray0.rows(), col.rows());
} }
public void testColRange() { public void testColRangeIntInt() {
Mat cols = gray0.colRange(0, gray0.cols() / 2); Mat cols = gray0.colRange(0, gray0.cols() / 2);
assertEquals(gray0.cols() / 2, cols.cols()); assertEquals(gray0.cols() / 2, cols.cols());
assertEquals(gray0.rows(), cols.rows()); assertEquals(gray0.rows(), cols.rows());
} }
public void testColRangeRange() {
fail("Not yet implemented");
}
public void testCols() { 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() { public void testCopyTo() {
@ -43,6 +83,22 @@ public class MatTest extends OpenCVTestCase {
assertMatEqual(rgbLena, dst); 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() { public void testCross() {
Mat answer = new Mat(1, 3, CvType.CV_32F); Mat answer = new Mat(1, 3, CvType.CV_32F);
answer.put(0, 0, 7.0, 1.0, -5.0); answer.put(0, 0, 7.0, 1.0, -5.0);
@ -53,6 +109,7 @@ public class MatTest extends OpenCVTestCase {
public void testDataAddr() { public void testDataAddr() {
assertTrue(0 != gray0.dataAddr()); assertTrue(0 != gray0.dataAddr());
assertEquals(0, new Mat().dataAddr());
} }
public void testDepth() { public void testDepth() {
@ -60,12 +117,16 @@ public class MatTest extends OpenCVTestCase {
assertEquals(CvType.CV_32F, gray0_32f.depth()); assertEquals(CvType.CV_32F, gray0_32f.depth());
} }
public void testRelease() { public void testDiag() {
assertTrue(gray0.empty() == false); fail("Not yet implemented");
assertTrue(gray0.rows() > 0); }
gray0.release();
assertTrue(gray0.empty() == true); public void testDiagInt() {
assertTrue(gray0.rows() == 0); fail("Not yet implemented");
}
public void testDiagMat() {
fail("Not yet implemented");
} }
public void testDot() { public void testDot() {
@ -83,6 +144,10 @@ public class MatTest extends OpenCVTestCase {
assertEquals(3, rgbLena.elemSize()); assertEquals(3, rgbLena.elemSize());
} }
public void testElemSize1() {
fail("Not yet implemented");
}
public void testEmpty() { public void testEmpty() {
assertTrue(dst.empty()); assertTrue(dst.empty());
assertTrue(!gray0.empty()); assertTrue(!gray0.empty());
@ -93,6 +158,14 @@ public class MatTest extends OpenCVTestCase {
assertMatEqual(eye, eye.inv(), EPS); assertMatEqual(eye, eye.inv(), EPS);
} }
public void testEyeIntIntInt() {
fail("Not yet implemented");
}
public void testEyeSizeInt() {
fail("Not yet implemented");
}
public void testGetIntInt() { public void testGetIntInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -102,6 +175,9 @@ public class MatTest extends OpenCVTestCase {
byte[] goodData = new byte[9]; byte[] goodData = new byte[9];
byte[] badData = new byte[7]; byte[] badData = new byte[7];
m.get(1, 1, goodData); m.get(1, 1, goodData);
assertTrue(Arrays.equals(new byte[] { 1, 2, 3, 1, 2, 3, 1, 2, 3 }, goodData));
try { try {
m.get(2, 2, badData); m.get(2, 2, badData);
fail("Expected UnsupportedOperationException (data.length % CvType.channels(t) != 0)"); fail("Expected UnsupportedOperationException (data.length % CvType.channels(t) != 0)");
@ -141,6 +217,10 @@ public class MatTest extends OpenCVTestCase {
assertMatEqual(grayE_32f, dst, EPS); assertMatEqual(grayE_32f, dst, EPS);
} }
public void testInvInt() {
fail("Not yet implemented");
}
public void testIsContinuous() { public void testIsContinuous() {
assertTrue(gray0.isContinuous()); assertTrue(gray0.isContinuous());
@ -154,9 +234,13 @@ public class MatTest extends OpenCVTestCase {
assertTrue(subMat.isSubmatrix()); assertTrue(subMat.isSubmatrix());
} }
public void testLocateROI() {
fail("Not yet implemented");
}
public void testMat() { public void testMat() {
Mat m = new Mat(); Mat m = new Mat();
assertTrue(null != m); assertNotNull(m);
assertTrue(m.empty()); assertTrue(m.empty());
} }
@ -196,6 +280,50 @@ public class MatTest extends OpenCVTestCase {
assertMatEqual(m2, gray0_32f, EPS); 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() { public void testPutIntIntByteArray() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -203,6 +331,7 @@ public class MatTest extends OpenCVTestCase {
public void testPutIntIntDoubleArray() { public void testPutIntIntDoubleArray() {
Mat m = new Mat(5, 5, CvType.CV_8UC3); Mat m = new Mat(5, 5, CvType.CV_8UC3);
m.put(1, 1, 10, 20, 30, 40, 50, 60); m.put(1, 1, 10, 20, 30, 40, 50, 60);
try { 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)"); fail("Expected UnsupportedOperationException (data.length % CvType.channels(t) != 0)");
@ -223,33 +352,92 @@ public class MatTest extends OpenCVTestCase {
fail("Not yet implemented"); 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() { public void testRow() {
Mat row = gray0.row(0); Mat row = gray0.row(0);
assertEquals(1, row.rows()); assertEquals(1, row.rows());
assertEquals(gray0.cols(), row.cols()); assertEquals(gray0.cols(), row.cols());
} }
public void testRowRange() { public void testRowRangeIntInt() {
fail("Not yet implemented");
Mat rows = gray0.rowRange(0, gray0.rows() / 2); Mat rows = gray0.rowRange(0, gray0.rows() / 2);
assertEquals(gray0.rows() / 2, rows.rows()); assertEquals(gray0.rows() / 2, rows.rows());
assertEquals(gray0.cols(), rows.cols()); assertEquals(gray0.cols(), rows.cols());
} }
public void testRowRangeRange() {
fail("Not yet implemented");
}
public void testRows() { public void testRows() {
assertEquals(matSize, gray0.rows()); assertEquals(matSize, gray0.rows());
} }
public void testSetTo() { public void testSetToMat() {
gray0.setTo(new Scalar(127)); fail("Not yet implemented");
assertMatEqual(gray127, gray0);
} }
public void testSubmat() { 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 testStep1Int() {
fail("Not yet implemented");
}
public void testSubmatIntIntIntInt() {
Mat submat = gray0.submat(0, gray0.rows() / 2, 0, gray0.cols() / 2); 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.rows() / 2, submat.rows());
assertEquals(gray0.cols() / 2, submat.cols()); 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() { public void testToString() {
assertTrue(null != gray0.toString()); assertTrue(null != gray0.toString());
} }
@ -271,4 +459,12 @@ public class MatTest extends OpenCVTestCase {
assertEquals(rgba128.cols(), rgba128.width()); assertEquals(rgba128.cols(), rgba128.width());
} }
public void testZerosIntIntInt() {
fail("Not yet implemented");
}
public void testZerosSizeInt() {
fail("Not yet implemented");
}
} }

View File

@ -42,6 +42,10 @@ public class Point3Test extends OpenCVTestCase {
assertFalse(flag); assertFalse(flag);
} }
public void testHashCode() {
assertEquals(p1.hashCode(), p1.hashCode());
}
public void testPoint3() { public void testPoint3() {
p1 = new Point3(); p1 = new Point3();

View File

@ -36,6 +36,10 @@ public class PointTest extends OpenCVTestCase {
assertFalse(flag); assertFalse(flag);
} }
public void testHashCode() {
assertEquals(p1.hashCode(), p1.hashCode());
}
public void testInside() { public void testInside() {
Rect rect = new Rect(0, 0, 5, 3); Rect rect = new Rect(0, 0, 5, 3);
assertTrue(p1.inside(rect)); assertTrue(p1.inside(rect));

View File

@ -5,9 +5,9 @@ import org.opencv.test.OpenCVTestCase;
public class RangeTest extends OpenCVTestCase { public class RangeTest extends OpenCVTestCase {
Range range;
Range r1; Range r1;
Range r2; Range r2;
Range range;
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
@ -47,6 +47,10 @@ public class RangeTest extends OpenCVTestCase {
assertTrue(r1.equals(range)); assertTrue(r1.equals(range));
} }
public void testHashCode() {
assertEquals(r1.hashCode(), r1.hashCode());
}
public void testIntersection() { public void testIntersection() {
range = r1.intersection(r2); range = r1.intersection(r2);
assertEquals(r2, range); assertEquals(r2, range);

View File

@ -65,6 +65,10 @@ public class RectTest extends OpenCVTestCase {
assertTrue(flag); assertTrue(flag);
} }
public void testHashCode() {
assertEquals(rect.hashCode(), rect.hashCode());
}
public void testRect() { public void testRect() {
r = new Rect(); r = new Rect();

View File

@ -21,10 +21,6 @@ public class RotatedRectTest extends OpenCVTestCase {
angle = 40; angle = 40;
} }
public void test_1() {
super.test_1("core.RotatedRect");
}
public void testBoundingRect() { public void testBoundingRect() {
size = new Size(matSize / 2, matSize / 2); size = new Size(matSize / 2, matSize / 2);
assertEquals(size.height, size.width); assertEquals(size.height, size.width);
@ -85,6 +81,11 @@ public class RotatedRectTest extends OpenCVTestCase {
assertTrue(!rrect1.equals(size)); assertTrue(!rrect1.equals(size));
} }
public void testHashCode() {
RotatedRect rr = new RotatedRect(center, size, angle);
assertEquals(rr.hashCode(), rr.hashCode());
}
public void testPoints() { public void testPoints() {
RotatedRect rrect = new RotatedRect(center, size, angle); RotatedRect rrect = new RotatedRect(center, size, angle);
@ -161,4 +162,8 @@ public class RotatedRectTest extends OpenCVTestCase {
assertTrue(rr.angle == 40.0); assertTrue(rr.angle == 40.0);
} }
public void testSet() {
fail("Not yet implemented");
}
} }

View File

@ -5,9 +5,9 @@ import org.opencv.test.OpenCVTestCase;
public class ScalarTest extends OpenCVTestCase { public class ScalarTest extends OpenCVTestCase {
private Scalar dstScalar;
private Scalar s1; private Scalar s1;
private Scalar s2; private Scalar s2;
private Scalar dstScalar;
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
@ -42,6 +42,10 @@ public class ScalarTest extends OpenCVTestCase {
assertFalse(s2.equals(s1)); assertFalse(s2.equals(s1));
} }
public void testHashCode() {
assertEquals(s2.hashCode(), s2.hashCode());
}
public void testIsReal() { public void testIsReal() {
assertTrue(s1.isReal()); assertTrue(s1.isReal());

View File

@ -6,9 +6,9 @@ import org.opencv.test.OpenCVTestCase;
public class SizeTest extends OpenCVTestCase { public class SizeTest extends OpenCVTestCase {
Size dstSize;
Size sz1; Size sz1;
Size sz2; Size sz2;
Size dstSize;
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
@ -36,6 +36,10 @@ public class SizeTest extends OpenCVTestCase {
assertTrue(sz1.equals(sz2)); assertTrue(sz1.equals(sz2));
} }
public void testHashCode() {
assertEquals(sz1.hashCode(), sz1.hashCode());
}
public void testSet() { public void testSet() {
double[] vals1 = {}; double[] vals1 = {};
sz2.set(vals1); sz2.set(vals1);

View File

@ -28,6 +28,10 @@ public class TermCriteriaTest extends OpenCVTestCase {
assertTrue(tc2.equals(tc1)); assertTrue(tc2.equals(tc1));
} }
public void testHashCode() {
assertEquals(tc2.hashCode(), tc2.hashCode());
}
public void testSet() { public void testSet() {
double[] vals1 = {}; double[] vals1 = {};
tc1.set(vals1); tc1.set(vals1);

View File

@ -34,7 +34,11 @@ public class BRIEFDescriptorExtractorTest extends OpenCVTestCase {
super.setUp(); 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); KeyPoint point = new KeyPoint(55.775577545166016f, 44.224422454833984f, 16, 9.754629f, 8617.863f, 1, -1);
List<KeyPoint> keypoints = Arrays.asList(point); List<KeyPoint> keypoints = Arrays.asList(point);
Mat img = getTestImg(); Mat img = getTestImg();

View File

@ -23,34 +23,12 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
int matSize; int matSize;
DMatch[] truth; DMatch[] truth;
protected void setUp() throws Exception { private Mat getMaskImg() {
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE); return new Mat(5, 2, CvType.CV_8U, new Scalar(0)) {
matSize = 100; {
put(0, 0, 1, 1, 1, 1);
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 getQueryDescriptors() { private Mat getQueryDescriptors() {
@ -71,6 +49,14 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
return descriptors; 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() { private Mat getTrainDescriptors() {
Mat img = getTrainImg(); 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)); 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; return descriptors;
} }
private Mat getMaskImg() { private Mat getTrainImg() {
return new Mat(5, 2, CvType.CV_8U, new Scalar(0)) { 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);
put(0,0, 1, 1, 1, 1); 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() { public void testAdd() {
@ -104,15 +104,6 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.empty()); 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() { public void testClone() {
Mat train = new Mat(1, 1, CvType.CV_8U, new Scalar(123)); Mat train = new Mat(1, 1, CvType.CV_8U, new Scalar(123));
Mat truth = train.clone(); Mat truth = train.clone();
@ -127,6 +118,15 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
assertMatEqual(truth, descriptors.get(0)); 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() { public void testCreate() {
assertNotNull(matcher); assertNotNull(matcher);
} }
@ -150,13 +150,49 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.isMaskSupported()); 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 train = getTrainDescriptors();
Mat query = getQueryDescriptors(); Mat query = getQueryDescriptors();
Mat mask = getMaskImg(); Mat mask = getMaskImg();
List<DMatch> matches = new ArrayList<DMatch>(); List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(train));
matcher.match(query, train, matches, mask); matcher.match(query, matches, Arrays.asList(mask));
assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS); assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
} }
@ -175,27 +211,39 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
// OpenCVTestRunner.Log(m.toString()); // OpenCVTestRunner.Log(m.toString());
} }
public void testMatchMatListOfDMatchListOfMat() { public void testMatchMatMatListOfDMatchMat() {
Mat train = getTrainDescriptors(); Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors(); Mat query = getQueryDescriptors();
Mat mask = getMaskImg(); Mat mask = getMaskImg();
List<DMatch> matches = new ArrayList<DMatch>(); 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); assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
} }
public void testMatchMatListOfDMatch() { public void testRadiusMatchMatListOfListOfDMatchFloat() {
Mat train = getTrainDescriptors(); fail("Not yet implemented");
Mat query = getQueryDescriptors(); }
List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(train));
matcher.match(query, matches); public void testRadiusMatchMatListOfListOfDMatchFloatListOfMat() {
fail("Not yet implemented");
}
assertListDMatchEquals(Arrays.asList(truth), matches, EPS); 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() { public void testRead() {

View File

@ -23,22 +23,16 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
int matSize; int matSize;
DMatch[] truth; DMatch[] truth;
protected void setUp() throws Exception { private Mat getMaskImg() {
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING); return new Mat(4, 4, CvType.CV_8U, new Scalar(0)) {
matSize = 100; {
put(0, 0, 1, 1, 1, 1, 1, 1, 1, 1);
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 getTrainImg() { private Mat getQueryDescriptors() {
Mat img = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255)); return getTestDescriptors(getQueryImg());
Core.line(img, new Point(40, 40), new Point(matSize - 40, matSize - 40), new Scalar(0), 8);
return img;
} }
private Mat getQueryImg() { private Mat getQueryImg() {
@ -60,20 +54,26 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
return descriptors; return descriptors;
} }
private Mat getQueryDescriptors() {
return getTestDescriptors(getQueryImg());
}
private Mat getTrainDescriptors() { private Mat getTrainDescriptors() {
return getTestDescriptors(getTrainImg()); return getTestDescriptors(getTrainImg());
} }
private Mat getMaskImg() { private Mat getTrainImg() {
return new Mat(4, 4, CvType.CV_8U, new Scalar(0)) { 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);
put(0, 0, 1, 1, 1, 1, 1, 1, 1, 1); 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() { public void testAdd() {
@ -89,15 +89,6 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.empty()); 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() { public void testClone() {
Mat train = new Mat(1, 1, CvType.CV_8U, new Scalar(123)); Mat train = new Mat(1, 1, CvType.CV_8U, new Scalar(123));
Mat truth = train.clone(); Mat truth = train.clone();
@ -112,6 +103,15 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
assertMatEqual(truth, descriptors.get(0)); 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() { public void testCreate() {
assertNotNull(matcher); assertNotNull(matcher);
} }
@ -135,23 +135,37 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.isMaskSupported()); assertTrue(matcher.isMaskSupported());
} }
public void testMatchMatMatListOfDMatchMat() { public void testKnnMatchMatListOfListOfDMatchInt() {
Mat train = getTrainDescriptors(); fail("Not yet implemented");
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 testMatchMatMatListOfDMatch() { 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 train = getTrainDescriptors();
Mat query = getQueryDescriptors(); Mat query = getQueryDescriptors();
List<DMatch> matches = new ArrayList<DMatch>(); List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(train));
matcher.match(query, train, matches); matcher.match(query, matches);
assertListDMatchEquals(Arrays.asList(truth), matches, EPS); assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
} }
@ -168,17 +182,51 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase {
assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS); assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
} }
public void testMatchMatListOfDMatch() { public void testMatchMatMatListOfDMatch() {
Mat train = getTrainDescriptors(); Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors(); Mat query = getQueryDescriptors();
List<DMatch> matches = new ArrayList<DMatch>(); 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); 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() { public void testRead() {
String filename = OpenCVTestRunner.getTempFileName("yml"); String filename = OpenCVTestRunner.getTempFileName("yml");
writeFile(filename, "%YAML:1.0\n"); writeFile(filename, "%YAML:1.0\n");

View File

@ -23,22 +23,16 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
int matSize; int matSize;
DMatch[] truth; DMatch[] truth;
protected void setUp() throws Exception { private Mat getMaskImg() {
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMINGLUT); return new Mat(4, 4, CvType.CV_8U, new Scalar(0)) {
matSize = 100; {
put(0, 0, 1, 1, 1, 1, 1, 1, 1, 1);
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 getTrainImg() { private Mat getQueryDescriptors() {
Mat img = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255)); return getTestDescriptors(getQueryImg());
Core.line(img, new Point(40, 40), new Point(matSize - 40, matSize - 40), new Scalar(0), 8);
return img;
} }
private Mat getQueryImg() { private Mat getQueryImg() {
@ -60,20 +54,26 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
return descriptors; return descriptors;
} }
private Mat getQueryDescriptors() {
return getTestDescriptors(getQueryImg());
}
private Mat getTrainDescriptors() { private Mat getTrainDescriptors() {
return getTestDescriptors(getTrainImg()); return getTestDescriptors(getTrainImg());
} }
private Mat getMaskImg() { private Mat getTrainImg() {
return new Mat(4, 4, CvType.CV_8U, new Scalar(0)) { 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);
put(0, 0, 1, 1, 1, 1, 1, 1, 1, 1); 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() { public void testAdd() {
@ -89,15 +89,6 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.empty()); 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() { public void testClone() {
Mat train = new Mat(1, 1, CvType.CV_8U, new Scalar(123)); Mat train = new Mat(1, 1, CvType.CV_8U, new Scalar(123));
Mat truth = train.clone(); Mat truth = train.clone();
@ -112,6 +103,15 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
assertMatEqual(truth, descriptors.get(0)); 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() { public void testCreate() {
assertNotNull(matcher); assertNotNull(matcher);
} }
@ -135,13 +135,49 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.isMaskSupported()); 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 train = getTrainDescriptors();
Mat query = getQueryDescriptors(); Mat query = getQueryDescriptors();
Mat mask = getMaskImg(); Mat mask = getMaskImg();
List<DMatch> matches = new ArrayList<DMatch>(); List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(train));
matcher.match(query, train, matches, mask); matcher.match(query, matches, Arrays.asList(mask));
assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS); assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
} }
@ -160,27 +196,39 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase {
assertListDMatchEquals(Arrays.asList(truth), matches, EPS); assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
} }
public void testMatchMatListOfDMatchListOfMat() { public void testMatchMatMatListOfDMatchMat() {
Mat train = getTrainDescriptors(); Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors(); Mat query = getQueryDescriptors();
Mat mask = getMaskImg(); Mat mask = getMaskImg();
List<DMatch> matches = new ArrayList<DMatch>(); 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); assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
} }
public void testMatchMatListOfDMatch() { public void testRadiusMatchMatListOfListOfDMatchFloat() {
Mat train = getTrainDescriptors(); fail("Not yet implemented");
Mat query = getQueryDescriptors(); }
List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(train));
matcher.match(query, matches); public void testRadiusMatchMatListOfListOfDMatchFloatListOfMat() {
fail("Not yet implemented");
}
assertListDMatchEquals(Arrays.asList(truth), matches, EPS); 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() { public void testRead() {

View File

@ -23,33 +23,12 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
int matSize; int matSize;
DMatch[] truth; DMatch[] truth;
protected void setUp() throws Exception { private Mat getMaskImg() {
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_L1); return new Mat(5, 2, CvType.CV_8U, new Scalar(0)) {
matSize = 100; {
put(0, 0, 1, 1, 1, 1);
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 getQueryDescriptors() { private Mat getQueryDescriptors() {
@ -70,6 +49,14 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
return descriptors; 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() { private Mat getTrainDescriptors() {
Mat img = getTrainImg(); 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)); 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; return descriptors;
} }
private Mat getMaskImg() { private Mat getTrainImg() {
return new Mat(5, 2, CvType.CV_8U, new Scalar(0)) { 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);
put(0,0, 1, 1, 1, 1); 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() { public void testAdd() {
@ -103,15 +103,6 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.empty()); 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() { public void testClone() {
Mat train = new Mat(1, 1, CvType.CV_8U, new Scalar(123)); Mat train = new Mat(1, 1, CvType.CV_8U, new Scalar(123));
Mat truth = train.clone(); Mat truth = train.clone();
@ -126,6 +117,15 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
assertMatEqual(truth, descriptors.get(0)); 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() { public void testCreate() {
assertNotNull(matcher); assertNotNull(matcher);
} }
@ -149,23 +149,37 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.isMaskSupported()); assertTrue(matcher.isMaskSupported());
} }
public void testMatchMatMatListOfDMatchMat() { public void testKnnMatchMatListOfListOfDMatchInt() {
Mat train = getTrainDescriptors(); fail("Not yet implemented");
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 testMatchMatMatListOfDMatch() { 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 train = getTrainDescriptors();
Mat query = getQueryDescriptors(); Mat query = getQueryDescriptors();
List<DMatch> matches = new ArrayList<DMatch>(); List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(train));
matcher.match(query, train, matches); matcher.match(query, matches);
assertListDMatchEquals(Arrays.asList(truth), matches, EPS); assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
} }
@ -182,17 +196,51 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS); assertListDMatchEquals(Arrays.asList(truth[0], truth[1]), matches, EPS);
} }
public void testMatchMatListOfDMatch() { public void testMatchMatMatListOfDMatch() {
Mat train = getTrainDescriptors(); Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors(); Mat query = getQueryDescriptors();
List<DMatch> matches = new ArrayList<DMatch>(); 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); 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() { public void testRead() {
String filename = OpenCVTestRunner.getTempFileName("yml"); String filename = OpenCVTestRunner.getTempFileName("yml");
writeFile(filename, "%YAML:1.0\n"); writeFile(filename, "%YAML:1.0\n");

View File

@ -0,0 +1,27 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -19,6 +19,19 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase {
FeatureDetector detector; FeatureDetector detector;
KeyPoint[] truth; KeyPoint[] truth;
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() {
Mat img = new Mat(100, 100, CvType.CV_8U, new Scalar(255));
Core.line(img, new Point(30, 30), new Point(70, 70), new Scalar(0), 8);
return img;
}
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
detector = FeatureDetector.create(FeatureDetector.FAST); detector = FeatureDetector.create(FeatureDetector.FAST);
@ -29,31 +42,16 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase {
super.setUp(); super.setUp();
} }
private Mat getTestImg() {
Mat img = new Mat(100, 100, CvType.CV_8U, new Scalar(255));
Core.line(img, new Point(30, 30), new Point(70, 70), new Scalar(0), 8);
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;
}
public void testCreate() { public void testCreate() {
assertNotNull(detector); assertNotNull(detector);
} }
public void testDetectMatListOfKeyPointMat() { public void testDetectListOfMatListOfListOfKeyPoint() {
Mat img = getTestImg(); fail("Not yet implemented");
Mat mask = getMaskImg(); }
List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
detector.detect(img, keypoints, mask); public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
assertListKeyPointEquals(Arrays.asList(truth[0], truth[1]), keypoints, EPS);
} }
public void testDetectMatListOfKeyPoint() { public void testDetectMatListOfKeyPoint() {
@ -69,6 +67,16 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase {
// OpenCVTestRunner.Log(kp.toString()); // 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() { public void testEmpty() {
assertFalse(detector.empty()); assertFalse(detector.empty());
} }

View File

@ -19,7 +19,59 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; 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() public void testPTOD()
{ {
@ -47,7 +99,8 @@ public class features2dTest extends OpenCVTestCase {
detector.detect(imgTrain, trainKeypoints); detector.detect(imgTrain, trainKeypoints);
detector.detect(imgQuery, queryKeypoints); 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 trainDescriptors = new Mat();
Mat queryDescriptors = new Mat(); Mat queryDescriptors = new Mat();

View File

@ -0,0 +1,127 @@
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");
}
}

View File

@ -20,34 +20,6 @@ import java.util.List;
public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase { public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
DescriptorMatcher matcher;
int matSize;
DMatch[] truth;
static final String ymlParamsDefault = "%YAML:1.0\n"
+ "indexParams:\n"
+ " -\n"
+ " name: algorithm\n"
+ " type: 23\n"
+ " value: 1\n"
+ " -\n"
+ " name: trees\n"
+ " type: 4\n"
+ " value: 4\n"
+ "searchParams:\n"
+ " -\n"
+ " name: checks\n"
+ " type: 4\n"
+ " value: 32\n"
+ " -\n"
+ " name: eps\n"
+ " type: 5\n"
+ " value: 0.\n"
+ " -\n"
+ " name: sorted\n"
+ " type: 15\n"
+ " value: 1\n";
static final String xmlParamsDefault = "<?xml version=\"1.0\"?>\n" static final String xmlParamsDefault = "<?xml version=\"1.0\"?>\n"
+ "<opencv_storage>\n" + "<opencv_storage>\n"
+ "<indexParams>\n" + "<indexParams>\n"
@ -73,13 +45,35 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
+ " <type>15</type>\n" + " <type>15</type>\n"
+ " <value>1</value></_></searchParams>\n" + " <value>1</value></_></searchParams>\n"
+ "</opencv_storage>\n"; + "</opencv_storage>\n";
static final String ymlParamsDefault = "%YAML:1.0\n"
static final String ymlParamsModified = "%YAML:1.0\n"
+ "indexParams:\n" + "indexParams:\n"
+ " -\n" + " -\n"
+ " name: algorithm\n" + " name: algorithm\n"
+ " type: 23\n" + " type: 23\n"
+ " value: 6\n"//this line is changed + " value: 1\n"
+ " -\n"
+ " name: trees\n"
+ " type: 4\n"
+ " value: 4\n"
+ "searchParams:\n"
+ " -\n"
+ " name: checks\n"
+ " type: 4\n"
+ " value: 32\n"
+ " -\n"
+ " name: eps\n"
+ " type: 5\n"
+ " value: 0.\n"
+ " -\n"
+ " name: sorted\n"
+ " type: 15\n"
+ " value: 1\n";
static final String ymlParamsModified = "%YAML:1.0\n"
+ "indexParams:\n"
+ " -\n"
+ " name: algorithm\n"
+ " type: 23\n"
+ " value: 6\n"// this line is changed!
+ " -\n" + " -\n"
+ " name: trees\n" + " name: trees\n"
+ " type: 4\n" + " type: 4\n"
@ -97,78 +91,15 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
+ " name: sorted\n" + " name: sorted\n"
+ " type: 15\n" + " type: 15\n"
+ " value: 1\n"; + " value: 1\n";
protected void setUp() throws Exception {
matcher = DescriptorMatcher.create(DescriptorMatcher.FLANNBASED);
matSize = 100;
truth = new DMatch[] { DescriptorMatcher matcher;
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(); int matSize;
}
private Mat getTrainImg() { DMatch[] truth;
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 getBriefQueryDescriptors() {
} return getBriefTestDescriptors(getBriefQueryImg());
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 getQueryDescriptors() {
Mat img = getQueryImg();
List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
Mat descriptors = new Mat();
FeatureDetector detector = FeatureDetector.create(FeatureDetector.SURF);
DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.SURF);
String filename = OpenCVTestRunner.getTempFileName("yml");
writeFile(filename, "%YAML:1.0\nhessianThreshold: 8000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n");
detector.read(filename);
detector.detect(img, keypoints);
extractor.compute(img, keypoints, descriptors);
return descriptors;
}
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));
Mat descriptors = new Mat();
DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.SURF);
extractor.compute(img, keypoints, descriptors);
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 getBriefTrainImg() {
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 getBriefQueryImg() { private Mat getBriefQueryImg() {
@ -190,14 +121,84 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
return descriptors; return descriptors;
} }
private Mat getBriefQueryDescriptors() {
return getBriefTestDescriptors(getBriefQueryImg());
}
private Mat getBriefTrainDescriptors() { private Mat getBriefTrainDescriptors() {
return getBriefTestDescriptors(getBriefTrainImg()); return getBriefTestDescriptors(getBriefTrainImg());
} }
private Mat getBriefTrainImg() {
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 getMaskImg() {
return new Mat(5, 2, CvType.CV_8U, new Scalar(0)) {
{
put(0, 0, 1, 1, 1, 1);
}
};
}
private Mat getQueryDescriptors() {
Mat img = getQueryImg();
List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
Mat descriptors = new Mat();
FeatureDetector detector = FeatureDetector.create(FeatureDetector.SURF);
DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.SURF);
String filename = OpenCVTestRunner.getTempFileName("yml");
writeFile(filename, "%YAML:1.0\nhessianThreshold: 8000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n");
detector.read(filename);
detector.detect(img, keypoints);
extractor.compute(img, keypoints, descriptors);
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));
Mat descriptors = new Mat();
DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.SURF);
extractor.compute(img, keypoints, descriptors);
return descriptors;
}
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.FLANNBASED);
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() { public void testAdd() {
matcher.add(Arrays.asList(new Mat())); matcher.add(Arrays.asList(new Mat()));
assertFalse(matcher.empty()); assertFalse(matcher.empty());
@ -211,15 +212,6 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
assertTrue(matcher.empty()); 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() { public void testClone() {
Mat train = new Mat(1, 1, CvType.CV_8U, new Scalar(123)); Mat train = new Mat(1, 1, CvType.CV_8U, new Scalar(123));
matcher.add(Arrays.asList(train)); matcher.add(Arrays.asList(train));
@ -232,6 +224,15 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
} }
} }
public void testCloneBoolean() {
matcher.add(Arrays.asList(new Mat()));
DescriptorMatcher cloned = matcher.clone(true);
assertNotNull(cloned);
assertTrue(cloned.empty());
}
public void testCreate() { public void testCreate() {
assertNotNull(matcher); assertNotNull(matcher);
} }
@ -255,13 +256,51 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
assertFalse(matcher.isMaskSupported()); assertFalse(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.train();
matcher.match(query, matches);
assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
}
public void testMatchMatListOfDMatchListOfMat() {
Mat train = getTrainDescriptors(); Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors(); Mat query = getQueryDescriptors();
Mat mask = getMaskImg(); Mat mask = getMaskImg();
List<DMatch> matches = new ArrayList<DMatch>(); List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(train));
matcher.train();
matcher.match(query, train, matches, mask); matcher.match(query, matches, Arrays.asList(mask));
assertListDMatchEquals(Arrays.asList(truth), matches, EPS); assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
} }
@ -280,29 +319,39 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
// OpenCVTestRunner.Log(m.toString()); // OpenCVTestRunner.Log(m.toString());
} }
public void testMatchMatListOfDMatchListOfMat() { public void testMatchMatMatListOfDMatchMat() {
Mat train = getTrainDescriptors(); Mat train = getTrainDescriptors();
Mat query = getQueryDescriptors(); Mat query = getQueryDescriptors();
Mat mask = getMaskImg(); Mat mask = getMaskImg();
List<DMatch> matches = new ArrayList<DMatch>(); List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(train));
matcher.train();
matcher.match(query, matches, Arrays.asList(mask)); matcher.match(query, train, matches, mask);
assertListDMatchEquals(Arrays.asList(truth), matches, EPS); assertListDMatchEquals(Arrays.asList(truth), matches, EPS);
} }
public void testMatchMatListOfDMatch() { public void testRadiusMatchMatListOfListOfDMatchFloat() {
Mat train = getTrainDescriptors(); fail("Not yet implemented");
Mat query = getQueryDescriptors(); }
List<DMatch> matches = new ArrayList<DMatch>();
matcher.add(Arrays.asList(train));
matcher.train();
matcher.match(query, matches); public void testRadiusMatchMatListOfListOfDMatchFloatListOfMat() {
fail("Not yet implemented");
}
assertListDMatchEquals(Arrays.asList(truth), matches, EPS); 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() { public void testRead() {

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -20,10 +20,6 @@ public class KeyPointTest extends OpenCVTestCase {
size = 3.0f; size = 3.0f;
} }
public void test_1() {
super.test_1("features2d.KeyPoint");
}
public void testGet_angle() { public void testGet_angle() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -102,4 +98,8 @@ public class KeyPointTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testToString() {
fail("Not yet implemented");
}
} }

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -34,7 +34,11 @@ public class ORBDescriptorExtractorTest extends OpenCVTestCase {
super.setUp(); 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); KeyPoint point = new KeyPoint(55.775577545166016f, 44.224422454833984f, 16, 9.754629f, 8617.863f, 1, -1);
List<KeyPoint> keypoints = Arrays.asList(point); List<KeyPoint> keypoints = Arrays.asList(point);
Mat img = getTestImg(); Mat img = getTestImg();

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,127 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -17,8 +17,8 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase {
DescriptorExtractor extractor; DescriptorExtractor extractor;
KeyPoint keypoint; KeyPoint keypoint;
Mat truth;
int matSize; int matSize;
Mat truth;
private Mat getTestImg() { private Mat getTestImg() {
Mat cross = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255)); Mat cross = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
@ -45,7 +45,11 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase {
super.setUp(); super.setUp();
} }
public void testCompute() { public void testComputeListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testComputeMatListOfKeyPointMat() {
List<KeyPoint> keypoints = Arrays.asList(keypoint); List<KeyPoint> keypoints = Arrays.asList(keypoint);
Mat img = getTestImg(); Mat img = getTestImg();
Mat descriptors = new Mat(); Mat descriptors = new Mat();
@ -77,7 +81,8 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase {
Mat descriptors = new Mat(); Mat descriptors = new Mat();
String filename = OpenCVTestRunner.getTempFileName("yml"); 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); extractor.read(filename);

View File

@ -0,0 +1,39 @@
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");
}
}

View File

@ -17,8 +17,30 @@ import java.util.List;
public class STARFeatureDetectorTest extends OpenCVTestCase { public class STARFeatureDetectorTest extends OpenCVTestCase {
FeatureDetector detector; FeatureDetector detector;
KeyPoint[] truth;
int matSize; 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 { protected void setUp() throws Exception {
detector = FeatureDetector.create(FeatureDetector.STAR); detector = FeatureDetector.create(FeatureDetector.STAR);
@ -39,32 +61,27 @@ public class STARFeatureDetectorTest extends OpenCVTestCase {
super.setUp(); 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;
}
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 testCreate() { public void testCreate() {
assertNotNull(detector); assertNotNull(detector);
} }
public void testDetectListOfMatListOfListOfKeyPoint() {
fail("Not yet implemented");
}
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
fail("Not yet implemented");
}
public void testDetectMatListOfKeyPoint() {
Mat img = getTestImg();
List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
detector.detect(img, keypoints);
assertListKeyPointEquals(Arrays.asList(truth), keypoints, EPS);
}
public void testDetectMatListOfKeyPointMat() { public void testDetectMatListOfKeyPointMat() {
Mat img = getTestImg(); Mat img = getTestImg();
Mat mask = getMaskImg(); Mat mask = getMaskImg();
@ -75,15 +92,6 @@ public class STARFeatureDetectorTest extends OpenCVTestCase {
assertListKeyPointEquals(Arrays.asList(truth[0], truth[2], truth[5], truth[7]), keypoints, EPS); assertListKeyPointEquals(Arrays.asList(truth[0], truth[2], truth[5], truth[7]), keypoints, EPS);
} }
public void testDetectMatListOfKeyPoint() {
Mat img = getTestImg();
List<KeyPoint> keypoints = new ArrayList<KeyPoint>();
detector.detect(img, keypoints);
assertListKeyPointEquals(Arrays.asList(truth), keypoints, EPS);
}
public void testEmpty() { public void testEmpty() {
assertFalse(detector.empty()); assertFalse(detector.empty());
} }

View File

@ -34,7 +34,11 @@ public class SURFDescriptorExtractorTest extends OpenCVTestCase {
super.setUp(); 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); KeyPoint point = new KeyPoint(55.775577545166016f, 44.224422454833984f, 16, 9.754629f, 8617.863f, 1, -1);
List<KeyPoint> keypoints = Arrays.asList(point); List<KeyPoint> keypoints = Arrays.asList(point);
Mat img = getTestImg(); Mat img = getTestImg();

View File

@ -19,21 +19,14 @@ import java.util.List;
public class SURFFeatureDetectorTest extends OpenCVTestCase { public class SURFFeatureDetectorTest extends OpenCVTestCase {
FeatureDetector detector; FeatureDetector detector;
KeyPoint[] truth;
int matSize; int matSize;
KeyPoint[] truth;
@Override private Mat getMaskImg() {
protected void setUp() throws Exception { Mat mask = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
detector = FeatureDetector.create(FeatureDetector.SURF); Mat right = mask.submat(0, matSize, matSize / 2, matSize);
right.setTo(new Scalar(0));
matSize = 100; return mask;
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 getTestImg() { private Mat getTestImg() {
@ -56,46 +49,24 @@ public class SURFFeatureDetectorTest extends OpenCVTestCase {
}); });
} }
private Mat getMaskImg() { @Override
Mat mask = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255)); protected void setUp() throws Exception {
Mat right = mask.submat(0, matSize, matSize / 2, matSize); detector = FeatureDetector.create(FeatureDetector.SURF);
right.setTo(new Scalar(0));
return mask; 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() { public void testCreate() {
assertNotNull(detector); assertNotNull(detector);
} }
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);
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);
}
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();
detector.detect(cross, keypoints);
order(keypoints);
assertListKeyPointEquals(Arrays.asList(truth), keypoints, EPS);
}
public void testDetectListOfMatListOfListOfKeyPoint() { public void testDetectListOfMatListOfListOfKeyPoint() {
String filename = OpenCVTestRunner.getTempFileName("yml"); String filename = OpenCVTestRunner.getTempFileName("yml");
writeFile(filename, "%YAML:1.0\nhessianThreshold: 8000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n"); writeFile(filename, "%YAML:1.0\nhessianThreshold: 8000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n");
@ -118,6 +89,39 @@ public class SURFFeatureDetectorTest extends OpenCVTestCase {
} }
} }
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();
detector.detect(cross, keypoints);
order(keypoints);
assertListKeyPointEquals(Arrays.asList(truth), keypoints, EPS);
}
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);
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);
}
public void testEmpty() { public void testEmpty() {
assertFalse(detector.empty()); assertFalse(detector.empty());
} }

View File

@ -4,7 +4,19 @@ import org.opencv.highgui.Highgui;
import org.opencv.test.OpenCVTestCase; import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner; 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() { public void testImreadString() {
dst = Highgui.imread(OpenCVTestRunner.LENA_PATH); dst = Highgui.imread(OpenCVTestRunner.LENA_PATH);
@ -22,4 +34,12 @@ public class highguiTest extends OpenCVTestCase {
assertTrue(512 == dst.rows()); assertTrue(512 == dst.rows());
} }
public void testImwriteStringMat() {
fail("Not yet implemented");
}
public void testImwriteStringMatListOfInteger() {
fail("Not yet implemented");
}
} }

View File

@ -1,5 +1,8 @@
package org.opencv.test.highgui; package org.opencv.test.highgui;
import java.util.List;
import org.opencv.core.Size;
import org.opencv.highgui.Highgui; import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture; import org.opencv.highgui.VideoCapture;
@ -8,8 +11,8 @@ import org.opencv.test.OpenCVTestCase;
public class VideoCaptureTest extends OpenCVTestCase { public class VideoCaptureTest extends OpenCVTestCase {
private VideoCapture capture; private VideoCapture capture;
private boolean isSucceed;
private boolean isOpened; private boolean isOpened;
private boolean isSucceed;
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
@ -20,15 +23,27 @@ public class VideoCaptureTest extends OpenCVTestCase {
isOpened = false; isOpened = false;
} }
public void test_1() {
super.test_1("HIGHGUI.VideoCapture");
}
public void testGet() { public void testGet() {
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID); capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
double frameWidth = capture.get(Highgui.CV_CAP_PROP_FRAME_WIDTH); double frameWidth = capture.get(Highgui.CV_CAP_PROP_FRAME_WIDTH);
capture.release();
assertTrue(0 != frameWidth); assertTrue(0 != frameWidth);
} finally {
if (capture != null) capture.release();
}
}
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() { public void testGrab() {
@ -38,10 +53,13 @@ public class VideoCaptureTest extends OpenCVTestCase {
} }
public void testGrabFromRealCamera() { public void testGrabFromRealCamera() {
try {
capture = new VideoCapture(Highgui.CV_CAP_ANDROID); capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
isSucceed = capture.grab(); isSucceed = capture.grab();
capture.release();
assertTrue(isSucceed); assertTrue(isSucceed);
} finally {
if (capture != null) capture.release();
}
} }
public void testIsOpened() { public void testIsOpened() {
@ -50,76 +68,110 @@ public class VideoCaptureTest extends OpenCVTestCase {
} }
public void testIsOpenedRealCamera() { public void testIsOpenedRealCamera() {
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID); capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
isOpened = capture.isOpened(); isOpened = capture.isOpened();
capture.release();
assertTrue(isOpened); assertTrue(isOpened);
} finally {
if (capture != null) capture.release();
}
} }
public void testOpen() { public void testOpen() {
try
{
capture = new VideoCapture(); capture = new VideoCapture();
capture.open(Highgui.CV_CAP_ANDROID); capture.open(Highgui.CV_CAP_ANDROID);
isOpened = capture.isOpened(); isOpened = capture.isOpened();
capture.release();
assertTrue(isOpened); assertTrue(isOpened);
} finally {
if (capture != null) capture.release();
}
} }
public void testRead() { public void testRead() {
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID); capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
isSucceed = capture.read(dst); isSucceed = capture.read(dst);
capture.release();
assertTrue(isSucceed); assertTrue(isSucceed);
assertFalse(dst.empty()); assertFalse(dst.empty());
assertEquals(3, dst.channels()); assertEquals(3, dst.channels());
} finally {
if (capture != null) capture.release();
}
} }
public void testRelease() { public void testRelease() {
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID); capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.release(); capture.release();
assertFalse(capture.isOpened()); assertFalse(capture.isOpened());
capture = null;
} finally {
if (capture != null) capture.release();
}
} }
public void testRetrieveMat() { public void testRetrieveMat() {
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID); capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.grab(); capture.grab();
isSucceed = capture.retrieve(dst); isSucceed = capture.retrieve(dst);
capture.release();
assertTrue(isSucceed); assertTrue(isSucceed);
assertFalse(dst.empty()); assertFalse(dst.empty());
assertEquals(3, dst.channels()); assertEquals(3, dst.channels());
} finally {
if (capture != null) capture.release();
}
} }
public void testRetrieveMatInt() { public void testRetrieveMatInt() {
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID); capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.grab(); capture.grab();
isSucceed = capture.retrieve(dst, 1); isSucceed = capture.retrieve(dst, Highgui.CV_CAP_ANDROID_GREY_FRAME);
capture.release();
assertTrue(isSucceed); assertTrue(isSucceed);
assertFalse(dst.empty()); assertFalse(dst.empty());
// OpenCVTestRunner.Log(dst.toString());
assertEquals(1, dst.channels()); assertEquals(1, dst.channels());
} finally {
if (capture != null) capture.release();
}
} }
public void testSet() { public void testSet() {
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID); capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, 640.0); 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); double frameWidth = capture.get(Highgui.CV_CAP_PROP_FRAME_WIDTH);
capture.read(dst); capture.read(dst);
capture.release();
assertEquals(640.0, frameWidth); assertEquals(640.0, frameWidth);
assertEquals(640, dst.cols()); assertEquals(640, dst.cols());
} finally {
if (capture != null) capture.release();
}
} }
public void testVideoCapture() { public void testVideoCapture() {
capture = new VideoCapture(); capture = new VideoCapture();
assertTrue(null != capture); assertNotNull(capture);
assertFalse(capture.isOpened());
} }
public void testVideoCaptureInt() { public void testVideoCaptureInt() {
try
{
capture = new VideoCapture(Highgui.CV_CAP_ANDROID); capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
assertTrue(null != capture); assertNotNull(capture);
isOpened = capture.isOpened(); assertTrue(capture.isOpened());
capture.release(); } finally {
assertTrue(isOpened); if (capture != null) capture.release();
}
} }
} }

View File

@ -15,14 +15,13 @@ import org.opencv.core.TermCriteria;
import org.opencv.imgproc.Imgproc; import org.opencv.imgproc.Imgproc;
import org.opencv.test.OpenCVTestCase; import org.opencv.test.OpenCVTestCase;
public class ImgprocTest extends OpenCVTestCase {
public class imgprocTest extends OpenCVTestCase {
private Mat gray_64f_2;
private Mat dst64F;
private Mat mask;
private int imgprocSz;
Point anchorPoint; Point anchorPoint;
private Mat dst64F;
private Mat gray_64f_2;
private int imgprocSz;
private Mat mask;
Size size; Size size;
@Override @Override
@ -38,10 +37,6 @@ public class imgprocTest extends OpenCVTestCase {
size = new Size(3, 3); size = new Size(3, 3);
} }
public void test_1() {
super.test_1("imgproc");
}
public void testAccumulateMatMat() { public void testAccumulateMatMat() {
Imgproc.accumulate(gray_64f_2, dst64F); Imgproc.accumulate(gray_64f_2, dst64F);
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(2)); truth = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(2));
@ -481,45 +476,44 @@ public class imgprocTest extends OpenCVTestCase {
Mat src = new Mat(imgprocSz, imgprocSz, CvType.CV_32FC1); Mat src = new Mat(imgprocSz, imgprocSz, CvType.CV_32FC1);
src.put(0, 0, 1, 2); src.put(0, 0, 1, 2);
src.put(1, 0, 2, 1); src.put(1, 0, 2, 1);
int blockSize = 5; int blockSize = 5;
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32FC1, new Scalar(0));
Imgproc.cornerMinEigenVal(src, dst, blockSize); Imgproc.cornerMinEigenVal(src, dst, blockSize);
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32FC1, new Scalar(0));
assertMatEqual(truth, dst, EPS); assertMatEqual(truth, dst, EPS);
Mat truth1 = new Mat(matSize, matSize, CvType.CV_32FC1, new Scalar(0));
Imgproc.cornerMinEigenVal(gray255, dst, blockSize); Imgproc.cornerMinEigenVal(gray255, dst, blockSize);
assertMatEqual(truth1, dst, EPS);
truth = new Mat(matSize, matSize, CvType.CV_32FC1, new Scalar(0));
assertMatEqual(truth, dst, EPS);
} }
public void testCornerMinEigenValMatMatIntInt() { public void testCornerMinEigenValMatMatIntInt() {
Mat src = Mat.eye(3, 3, CvType.CV_32FC1); Mat src = Mat.eye(3, 3, CvType.CV_32FC1);
truth = new Mat(3, 3, CvType.CV_32FC1, new Scalar(0));
int blockSize = 3; int blockSize = 3;
int ksize = 5; int ksize = 5;
Imgproc.cornerMinEigenVal(src, dst, blockSize, ksize);
truth = new Mat(3, 3, CvType.CV_32FC1, new Scalar(0));
truth.put(0, 0, 0.055555549, 0.027777772, 0.055555549); truth.put(0, 0, 0.055555549, 0.027777772, 0.055555549);
truth.put(1, 0, 0.027777772, 0.055555549, 0.027777772); truth.put(1, 0, 0.027777772, 0.055555549, 0.027777772);
truth.put(2, 0, 0.055555549, 0.027777772, 0.055555549); truth.put(2, 0, 0.055555549, 0.027777772, 0.055555549);
Imgproc.cornerMinEigenVal(src, dst, blockSize, ksize);
assertMatEqual(truth, dst, EPS); assertMatEqual(truth, dst, EPS);
} }
public void testCornerMinEigenValMatMatIntIntInt() { public void testCornerMinEigenValMatMatIntIntInt() {
Mat src = Mat.eye(3, 3, CvType.CV_32FC1); Mat src = Mat.eye(3, 3, CvType.CV_32FC1);
truth = new Mat(3, 3, CvType.CV_32FC1, new Scalar(0));
int blockSize = 3; int blockSize = 3;
int ksize = 5; int ksize = 5;
Imgproc.cornerMinEigenVal(src, dst, blockSize, ksize, Imgproc.BORDER_REFLECT);
truth = new Mat(3, 3, CvType.CV_32FC1, new Scalar(0));
truth.put(0, 0, 0.68055558, 0.92708349, 0.5868057); truth.put(0, 0, 0.68055558, 0.92708349, 0.5868057);
truth.put(1, 0, 0.92708343, 0.92708343, 0.92708343); truth.put(1, 0, 0.92708343, 0.92708343, 0.92708343);
truth.put(2, 0, 0.58680564, 0.92708343, 0.68055564); truth.put(2, 0, 0.58680564, 0.92708343, 0.68055564);
Imgproc.cornerMinEigenVal(src, dst, blockSize, ksize, Imgproc.BORDER_REFLECT);
assertMatEqual(truth, dst, EPS); assertMatEqual(truth, dst, EPS);
} }
@ -558,6 +552,7 @@ public class imgprocTest extends OpenCVTestCase {
assertMatEqual(gray255, dst); assertMatEqual(gray255, dst);
Imgproc.dilate(gray1, dst, kernel); Imgproc.dilate(gray1, dst, kernel);
assertMatEqual(gray1, dst); assertMatEqual(gray1, dst);
} }
@ -565,6 +560,7 @@ public class imgprocTest extends OpenCVTestCase {
Mat kernel = new Mat(); Mat kernel = new Mat();
Imgproc.dilate(gray255, dst, kernel, anchorPoint); Imgproc.dilate(gray255, dst, kernel, anchorPoint);
assertMatEqual(gray255, dst); assertMatEqual(gray255, dst);
} }
@ -572,6 +568,7 @@ public class imgprocTest extends OpenCVTestCase {
Mat kernel = new Mat(); Mat kernel = new Mat();
Imgproc.dilate(gray255, dst, kernel, anchorPoint, 10); Imgproc.dilate(gray255, dst, kernel, anchorPoint, 10);
assertMatEqual(gray255, dst); assertMatEqual(gray255, dst);
} }
@ -579,6 +576,7 @@ public class imgprocTest extends OpenCVTestCase {
Mat kernel = new Mat(); Mat kernel = new Mat();
Imgproc.dilate(gray255, dst, kernel, anchorPoint, 10, Imgproc.BORDER_REFLECT); Imgproc.dilate(gray255, dst, kernel, anchorPoint, 10, Imgproc.BORDER_REFLECT);
assertMatEqual(gray255, dst); assertMatEqual(gray255, dst);
} }
@ -587,15 +585,17 @@ public class imgprocTest extends OpenCVTestCase {
Scalar value = new Scalar(0); Scalar value = new Scalar(0);
Imgproc.dilate(gray255, dst, kernel, anchorPoint, 10, Imgproc.BORDER_REFLECT, value); Imgproc.dilate(gray255, dst, kernel, anchorPoint, 10, Imgproc.BORDER_REFLECT, value);
assertMatEqual(gray255, dst); assertMatEqual(gray255, dst);
} }
public void testDistanceTransform() { public void testDistanceTransform() {
truth = new Mat(matSize, matSize, CvType.CV_32FC1, new Scalar(8192)); truth = new Mat(matSize, matSize, CvType.CV_32FC1, new Scalar(8192));
Mat dstLables = new Mat(matSize, matSize, CvType.CV_32SC1, new Scalar(0)); Mat dstLables = new Mat(matSize, matSize, CvType.CV_32SC1, new Scalar(0));
Mat labels = new Mat(); Mat labels = new Mat();
Imgproc.distanceTransform(gray128, dst, labels, Imgproc.CV_DIST_L2, 3); Imgproc.distanceTransform(gray128, dst, labels, Imgproc.CV_DIST_L2, 3);
assertMatEqual(truth, dst, EPS); assertMatEqual(truth, dst, EPS);
assertMatEqual(dstLables, labels); assertMatEqual(dstLables, labels);
} }
@ -606,9 +606,10 @@ public class imgprocTest extends OpenCVTestCase {
Core.rectangle(gray0, new Point(1, 2), new Point(7, 8), new Scalar(100)); Core.rectangle(gray0, new Point(1, 2), new Point(7, 8), new Scalar(100));
Imgproc.findContours(gray0, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE); Imgproc.findContours(gray0, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
assertTrue(1 == contours.size()); assertTrue(1 == contours.size());
assertFalse(0 == Core.countNonZero(gray0)); assertFalse(0 == Core.countNonZero(gray0));
Imgproc.drawContours(gray0, contours, -1, new Scalar(0)); Imgproc.drawContours(gray0, contours, -1, new Scalar(0));
assertTrue(0 == Core.countNonZero(gray0)); assertTrue(0 == Core.countNonZero(gray0));
} }
@ -642,7 +643,9 @@ public class imgprocTest extends OpenCVTestCase {
public void testErodeMatMatMat() { public void testErodeMatMatMat() {
Mat kernel = new Mat(); Mat kernel = new Mat();
Imgproc.erode(gray128, dst, kernel); Imgproc.erode(gray128, dst, kernel);
assertMatEqual(gray128, dst); assertMatEqual(gray128, dst);
} }
@ -651,11 +654,11 @@ public class imgprocTest extends OpenCVTestCase {
src.put(0, 0, 1, 4, 8); src.put(0, 0, 1, 4, 8);
src.put(1, 0, 2, 0, 1); src.put(1, 0, 2, 0, 1);
src.put(2, 0, 3, 4, 6); src.put(2, 0, 3, 4, 6);
truth = new Mat(3, 3, CvType.CV_8U, new Scalar(0.0));
Mat kernel = new Mat(); Mat kernel = new Mat();
Imgproc.erode(src, dst, kernel, anchorPoint); Imgproc.erode(src, dst, kernel, anchorPoint);
truth = new Mat(3, 3, CvType.CV_8U, new Scalar(0.0));
assertMatEqual(truth, dst); assertMatEqual(truth, dst);
} }
@ -664,11 +667,11 @@ public class imgprocTest extends OpenCVTestCase {
src.put(0, 0, 15, 9, 10); src.put(0, 0, 15, 9, 10);
src.put(1, 0, 10, 8, 12); src.put(1, 0, 10, 8, 12);
src.put(2, 0, 12, 20, 25); src.put(2, 0, 12, 20, 25);
truth = new Mat(3, 3, CvType.CV_8U, new Scalar(8.0));
Mat kernel = new Mat(); Mat kernel = new Mat();
Imgproc.erode(src, dst, kernel, anchorPoint, 10); Imgproc.erode(src, dst, kernel, anchorPoint, 10);
truth = new Mat(3, 3, CvType.CV_8U, new Scalar(8.0));
assertMatEqual(truth, dst); assertMatEqual(truth, dst);
} }
@ -677,11 +680,11 @@ public class imgprocTest extends OpenCVTestCase {
src.put(0, 0, 15, 9, 10); src.put(0, 0, 15, 9, 10);
src.put(1, 0, 10, 8, 12); src.put(1, 0, 10, 8, 12);
src.put(2, 0, 12, 20, 25); src.put(2, 0, 12, 20, 25);
truth = new Mat(3, 3, CvType.CV_8U, new Scalar(8.0));
Mat kernel = new Mat(); Mat kernel = new Mat();
Imgproc.erode(src, dst, kernel, anchorPoint, 10, Imgproc.BORDER_REFLECT); Imgproc.erode(src, dst, kernel, anchorPoint, 10, Imgproc.BORDER_REFLECT);
truth = new Mat(3, 3, CvType.CV_8U, new Scalar(8.0));
assertMatEqual(truth, dst); assertMatEqual(truth, dst);
} }
@ -690,12 +693,12 @@ public class imgprocTest extends OpenCVTestCase {
src.put(0, 0, 15, 9, 10); src.put(0, 0, 15, 9, 10);
src.put(1, 0, 10, 8, 12); src.put(1, 0, 10, 8, 12);
src.put(2, 0, 12, 20, 25); src.put(2, 0, 12, 20, 25);
truth = new Mat(3, 3, CvType.CV_8U, new Scalar(8.0));
Mat kernel = new Mat(); Mat kernel = new Mat();
Scalar sc = new Scalar(3, 3); Scalar sc = new Scalar(3, 3);
Imgproc.erode(src, dst, kernel, anchorPoint, 10, Imgproc.BORDER_REFLECT, sc); Imgproc.erode(src, dst, kernel, anchorPoint, 10, Imgproc.BORDER_REFLECT, sc);
truth = new Mat(3, 3, CvType.CV_8U, new Scalar(8.0));
assertMatEqual(truth, dst); assertMatEqual(truth, dst);
} }
@ -703,13 +706,13 @@ public class imgprocTest extends OpenCVTestCase {
Mat src = Mat.eye(4, 4, CvType.CV_32F); Mat src = Mat.eye(4, 4, CvType.CV_32F);
Mat kernel = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(1.0)); Mat kernel = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(1.0));
truth = Mat.eye(4, 4, CvType.CV_32F); Imgproc.filter2D(src, dst, -1, kernel);
truth = new Mat(4, 4, CvType.CV_32F);
truth.put(0, 0, 2, 2, 1, 0); truth.put(0, 0, 2, 2, 1, 0);
truth.put(1, 0, 2, 2, 1, 0); truth.put(1, 0, 2, 2, 1, 0);
truth.put(2, 0, 1, 1, 2, 1); truth.put(2, 0, 1, 1, 2, 1);
truth.put(3, 0, 0, 0, 1, 2); truth.put(3, 0, 0, 0, 1, 2);
Imgproc.filter2D(src, dst, -1, kernel);
assertMatEqual(truth, dst, EPS); assertMatEqual(truth, dst, EPS);
} }
@ -718,14 +721,20 @@ public class imgprocTest extends OpenCVTestCase {
Point point = new Point(0, 0); Point point = new Point(0, 0);
Imgproc.filter2D(gray128, dst, -1, kernel, point); Imgproc.filter2D(gray128, dst, -1, kernel, point);
assertMatEqual(gray255, dst); assertMatEqual(gray255, dst);
} }
public void testFilter2DMatMatIntMatPointDouble() {
fail("Not yet implemented");
}
public void testFilter2DMatMatIntMatPointDoubleInt() { public void testFilter2DMatMatIntMatPointDoubleInt() {
Mat kernel = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(0.0)); Mat kernel = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(0.0));
Point point = new Point(0, 0); Point point = new Point(0, 0);
Imgproc.filter2D(gray128, dst, -1, kernel, point, 2.0, Imgproc.BORDER_CONSTANT); Imgproc.filter2D(gray128, dst, -1, kernel, point, 2.0, Imgproc.BORDER_CONSTANT);
assertMatEqual(gray2, dst); assertMatEqual(gray2, dst);
} }
@ -735,6 +744,7 @@ public class imgprocTest extends OpenCVTestCase {
Mat hierarchy = dst; Mat hierarchy = dst;
Imgproc.findContours(img, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE); Imgproc.findContours(img, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
// no contours on empty image // no contours on empty image
assertEquals(contours.size(), 0); assertEquals(contours.size(), 0);
assertEquals(contours.size(), hierarchy.total()); assertEquals(contours.size(), hierarchy.total());
@ -743,6 +753,7 @@ public class imgprocTest extends OpenCVTestCase {
Core.rectangle(img, new Point(30, 35), new Point(40, 45), new Scalar(200)); Core.rectangle(img, new Point(30, 35), new Point(40, 45), new Scalar(200));
Imgproc.findContours(img, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE); Imgproc.findContours(img, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
// two contours of two rectangles // two contours of two rectangles
assertEquals(contours.size(), 2); assertEquals(contours.size(), 2);
assertEquals(contours.size(), hierarchy.total()); assertEquals(contours.size(), hierarchy.total());
@ -772,9 +783,10 @@ public class imgprocTest extends OpenCVTestCase {
points.add(new Point(1, 1)); points.add(new Point(1, 1));
points.add(new Point(1, -1)); points.add(new Point(1, -1));
points.add(new Point(-1, -1)); points.add(new Point(-1, -1));
RotatedRect rrect = new RotatedRect(); RotatedRect rrect = new RotatedRect();
rrect = Imgproc.fitEllipse(points); rrect = Imgproc.fitEllipse(points);
assertEquals(0.0, rrect.center.x); assertEquals(0.0, rrect.center.x);
assertEquals(0.0, rrect.center.y); assertEquals(0.0, rrect.center.y);
assertEquals(2.53, rrect.size.width, EPS); assertEquals(2.53, rrect.size.width, EPS);
@ -789,39 +801,31 @@ public class imgprocTest extends OpenCVTestCase {
linePoints.put(0, 0, 0.53196341, 0.84676737, 2.496531, 3.7467217); linePoints.put(0, 0, 0.53196341, 0.84676737, 2.496531, 3.7467217);
Imgproc.fitLine(points, dst, Imgproc.CV_DIST_L12, 0, 0.01, 0.01); Imgproc.fitLine(points, dst, Imgproc.CV_DIST_L12, 0, 0.01, 0.01);
assertMatEqual(linePoints, dst, EPS); assertMatEqual(linePoints, dst, EPS);
} }
public void testFloodFillMatMatPointScalar() { public void testFloodFillMatMatPointScalar() {
Mat mask = new Mat(matSize + 2, matSize + 2, CvType.CV_8U); Mat mask = new Mat(matSize + 2, matSize + 2, CvType.CV_8U, new Scalar(0));
Mat img = gray0; Mat img = gray0;
img.setTo(new Scalar(0));
mask.setTo(new Scalar(0));
Core.circle(mask, new Point(matSize / 2 + 1, matSize / 2 + 1), 3, new Scalar(2)); Core.circle(mask, new Point(matSize / 2 + 1, matSize / 2 + 1), 3, new Scalar(2));
int retval = Imgproc.floodFill(img, mask, new Point(matSize / 2, matSize / 2), new Scalar(1)); int retval = Imgproc.floodFill(img, mask, new Point(matSize / 2, matSize / 2), new Scalar(1));
assertEquals(Core.countNonZero(img), retval); assertEquals(Core.countNonZero(img), retval);
Core.circle(mask, new Point(matSize / 2 + 1, matSize / 2 + 1), 3, new Scalar(0)); Core.circle(mask, new Point(matSize / 2 + 1, matSize / 2 + 1), 3, new Scalar(0));
assertEquals(retval + 4 * (matSize + 1), Core.countNonZero(mask)); assertEquals(retval + 4 * (matSize + 1), Core.countNonZero(mask));
assertMatEqual(mask.submat(1, matSize + 1, 1, matSize + 1), img); assertMatEqual(mask.submat(1, matSize + 1, 1, matSize + 1), img);
} }
public void testFloodFillMatMatPointScalar_WithoutMask() { public void testFloodFillMatMatPointScalar_WithoutMask() {
Mat img = gray0; Mat img = gray0;
Core.circle(img, new Point(matSize / 2, matSize / 2), 3, new Scalar(2)); Core.circle(img, new Point(matSize / 2, matSize / 2), 3, new Scalar(2));
// TODO: ideally we should pass null instead of "new Mat()" // TODO: ideally we should pass null instead of "new Mat()"
int retval = Imgproc.floodFill(img, new Mat(), new Point(matSize / 2, matSize / 2), new Scalar(1)); int retval = Imgproc.floodFill(img, new Mat(), new Point(matSize / 2, matSize / 2), new Scalar(1));
Core.circle(img, new Point(matSize / 2, matSize / 2), 3, new Scalar(0)); Core.circle(img, new Point(matSize / 2, matSize / 2), 3, new Scalar(0));
assertEquals(Core.countNonZero(img), retval); assertEquals(Core.countNonZero(img), retval);
} }
@ -847,16 +851,17 @@ public class imgprocTest extends OpenCVTestCase {
Imgproc.GaussianBlur(gray2, dst, size, 1.0); Imgproc.GaussianBlur(gray2, dst, size, 1.0);
assertMatEqual(gray2, dst); assertMatEqual(gray2, dst);
} }
public void testGaussianBlurMatMatSizeDoubleDouble() { public void testGaussianBlurMatMatSizeDoubleDouble() {
Imgproc.GaussianBlur(gray2, dst, size, 0.0, 0.0); Imgproc.GaussianBlur(gray2, dst, size, 0.0, 0.0);
assertMatEqual(gray2, dst); assertMatEqual(gray2, dst);
} }
public void testGaussianBlurMatMatSizeDoubleDoubleInt() { public void testGaussianBlurMatMatSizeDoubleDoubleInt() {
Imgproc.GaussianBlur(gray2, dst, size, 1.0, 3.0, Imgproc.BORDER_REFLECT); Imgproc.GaussianBlur(gray2, dst, size, 1.0, 3.0, Imgproc.BORDER_REFLECT);
assertMatEqual(gray2, dst); assertMatEqual(gray2, dst);
} }
@ -865,27 +870,24 @@ public class imgprocTest extends OpenCVTestCase {
} }
public void testGetDefaultNewCameraMatrixMat() { public void testGetDefaultNewCameraMatrixMat() {
truth = new Mat(); Mat mtx = Imgproc.getDefaultNewCameraMatrix(gray0);
truth = Imgproc.getDefaultNewCameraMatrix(gray0); assertFalse(mtx.empty());
assertTrue(0 == Core.countNonZero(truth)); assertEquals(0, Core.countNonZero(mtx));
assertFalse(truth.empty());
} }
public void testGetDefaultNewCameraMatrixMatSize() { public void testGetDefaultNewCameraMatrixMatSize() {
truth = new Mat(); Mat mtx = Imgproc.getDefaultNewCameraMatrix(gray0, size);
truth = Imgproc.getDefaultNewCameraMatrix(gray0, size); assertFalse(mtx.empty());
assertTrue(0 == Core.countNonZero(truth)); assertEquals(0, Core.countNonZero(mtx));
assertFalse(truth.empty());
} }
public void testGetDefaultNewCameraMatrixMatSizeBoolean() { public void testGetDefaultNewCameraMatrixMatSizeBoolean() {
truth = new Mat(); Mat mtx = Imgproc.getDefaultNewCameraMatrix(gray0, size, true);
truth = Imgproc.getDefaultNewCameraMatrix(gray0, size, true); assertFalse(mtx.empty());
assertTrue(0 != Core.countNonZero(truth)); assertFalse(0 == Core.countNonZero(mtx));
assertFalse(truth.empty());
} }
public void testGetDerivKernelsMatMatIntIntInt() { public void testGetDerivKernelsMatMatIntIntInt() {
@ -952,6 +954,7 @@ public class imgprocTest extends OpenCVTestCase {
truth = new Mat(1, 1, CvType.CV_64FC1, new Scalar(1.0)); truth = new Mat(1, 1, CvType.CV_64FC1, new Scalar(1.0));
dst = Imgproc.getGaussianKernel(1, 0.5); dst = Imgproc.getGaussianKernel(1, 0.5);
assertMatEqual(truth, dst, EPS); assertMatEqual(truth, dst, EPS);
} }
@ -960,15 +963,21 @@ public class imgprocTest extends OpenCVTestCase {
truth.put(0, 0, 0.23899426, 0.52201146, 0.23899426); truth.put(0, 0, 0.23899426, 0.52201146, 0.23899426);
dst = Imgproc.getGaussianKernel(3, 0.8, CvType.CV_32F); dst = Imgproc.getGaussianKernel(3, 0.8, CvType.CV_32F);
assertMatEqual(truth, dst, EPS); assertMatEqual(truth, dst, EPS);
} }
public void testGetPerspectiveTransform() {
fail("Not yet implemented");
}
public void testGetRectSubPixMatSizePointMat() { public void testGetRectSubPixMatSizePointMat() {
truth = new Mat(3, 3, CvType.CV_8U, new Scalar(255)); truth = new Mat(3, 3, CvType.CV_8U, new Scalar(255));
Size size = new Size(3, 3); Size size = new Size(3, 3);
Point center = new Point(gray255.cols() / 2, gray255.rows() / 2); Point center = new Point(gray255.cols() / 2, gray255.rows() / 2);
Imgproc.getRectSubPix(gray255, size, center, dst); Imgproc.getRectSubPix(gray255, size, center, dst);
assertMatEqual(truth, dst); assertMatEqual(truth, dst);
} }
@ -1009,7 +1018,7 @@ public class imgprocTest extends OpenCVTestCase {
assertMatEqual(truth, dst); assertMatEqual(truth, dst);
} }
public void testGoodFeaturesToTrackMatMatIntDoubleDouble() { public void testGoodFeaturesToTrackMatListOfPointIntDoubleDouble() {
Mat src = gray0; Mat src = gray0;
Core.rectangle(src, new Point(2, 2), new Point(8, 8), new Scalar(100), -1); Core.rectangle(src, new Point(2, 2), new Point(8, 8), new Scalar(100), -1);
List<Point> lp = new ArrayList<Point>(); List<Point> lp = new ArrayList<Point>();
@ -1019,7 +1028,7 @@ public class imgprocTest extends OpenCVTestCase {
assertEquals(4, lp.size()); assertEquals(4, lp.size());
} }
public void testGoodFeaturesToTrackMatMatIntDoubleDoubleMat() { public void testGoodFeaturesToTrackMatListOfPointIntDoubleDoubleMat() {
Mat src = gray128; Mat src = gray128;
Point tl = new Point(2, 2); Point tl = new Point(2, 2);
Point br = new Point(8, 8); Point br = new Point(8, 8);
@ -1034,7 +1043,7 @@ public class imgprocTest extends OpenCVTestCase {
assertEquals(1, lp.size()); assertEquals(1, lp.size());
} }
public void testGoodFeaturesToTrackMatMatIntDoubleDoubleMatInt() { public void testGoodFeaturesToTrackMatListOfPointIntDoubleDoubleMatInt() {
Mat src = gray0; Mat src = gray0;
Core.rectangle(src, new Point(2, 2), new Point(8, 8), new Scalar(100), -1); Core.rectangle(src, new Point(2, 2), new Point(8, 8), new Scalar(100), -1);
List<Point> lp = new ArrayList<Point>(); List<Point> lp = new ArrayList<Point>();
@ -1044,7 +1053,7 @@ public class imgprocTest extends OpenCVTestCase {
assertEquals(4, lp.size()); assertEquals(4, lp.size());
} }
public void testGoodFeaturesToTrackMatMatIntDoubleDoubleMatIntBoolean() { public void testGoodFeaturesToTrackMatListOfPointIntDoubleDoubleMatIntBoolean() {
Mat src = gray0; Mat src = gray0;
Core.rectangle(src, new Point(2, 2), new Point(8, 8), new Scalar(100), -1); Core.rectangle(src, new Point(2, 2), new Point(8, 8), new Scalar(100), -1);
List<Point> lp = new ArrayList<Point>(); List<Point> lp = new ArrayList<Point>();
@ -1054,7 +1063,7 @@ public class imgprocTest extends OpenCVTestCase {
assertEquals(4, lp.size()); assertEquals(4, lp.size());
} }
public void testGoodFeaturesToTrackMatMatIntDoubleDoubleMatIntBooleanDouble() { public void testGoodFeaturesToTrackMatListOfPointIntDoubleDoubleMatIntBooleanDouble() {
Mat src = gray0; Mat src = gray0;
Core.rectangle(src, new Point(2, 2), new Point(8, 8), new Scalar(100), -1); Core.rectangle(src, new Point(2, 2), new Point(8, 8), new Scalar(100), -1);
List<Point> lp = new ArrayList<Point>(); List<Point> lp = new ArrayList<Point>();
@ -1526,6 +1535,7 @@ public class imgprocTest extends OpenCVTestCase {
int ksize = 3; int ksize = 3;
Imgproc.preCornerDetect(src, dst, ksize, Imgproc.BORDER_REFLECT); Imgproc.preCornerDetect(src, dst, ksize, Imgproc.BORDER_REFLECT);
assertMatEqual(truth, dst, EPS); assertMatEqual(truth, dst, EPS);
} }

View File

@ -4,10 +4,6 @@ import org.opencv.test.OpenCVTestCase;
public class MomentsTest extends OpenCVTestCase { public class MomentsTest extends OpenCVTestCase {
protected void setUp() throws Exception {
super.setUp();
}
public void testGet_m00() { public void testGet_m00() {
fail("Not yet implemented"); fail("Not yet implemented");
} }

View File

@ -1,12 +1,10 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvANN_MLP;
public class CvANN_MLPTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvANN_MLPTest extends TestCase {
super.setUp();
}
public void testClear() { public void testClear() {
fail("Not yet implemented"); fail("Not yet implemented");
@ -29,7 +27,7 @@ public class CvANN_MLPTest extends OpenCVTestCase {
} }
public void testCvANN_MLP() { public void testCvANN_MLP() {
fail("Not yet implemented"); new CvANN_MLP();
} }
public void testCvANN_MLPMat() { public void testCvANN_MLPMat() {

View File

@ -1,11 +1,13 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvANN_MLP_TrainParams;
public class CvANN_MLP_TrainParamsTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvANN_MLP_TrainParamsTest extends TestCase {
super.setUp();
public void testCvANN_MLP_TrainParams() {
new CvANN_MLP_TrainParams();
} }
public void testGet_bp_dw_scale() { public void testGet_bp_dw_scale() {

View File

@ -1,11 +1,13 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvBoostParams;
public class CvBoostParamsTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvBoostParamsTest extends TestCase {
super.setUp();
public void testCvBoostParams() {
new CvBoostParams();
} }
public void testGet_boost_type() { public void testGet_boost_type() {

View File

@ -1,19 +1,17 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvBoost;
public class CvBoostTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvBoostTest extends TestCase {
super.setUp();
}
public void testClear() { public void testClear() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCvBoost() { public void testCvBoost() {
fail("Not yet implemented"); new CvBoost();
} }
public void testCvBoostMatIntMat() { public void testCvBoostMatIntMat() {

View File

@ -1,11 +1,13 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvDTreeParams;
public class CvDTreeParamsTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvDTreeParamsTest extends TestCase {
super.setUp();
public void testCvDTreeParams() {
new CvDTreeParams();
} }
public void testGet_cv_folds() { public void testGet_cv_folds() {

View File

@ -1,19 +1,17 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvDTree;
public class CvDTreeTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvDTreeTest extends TestCase {
super.setUp();
}
public void testClear() { public void testClear() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCvDTree() { public void testCvDTree() {
fail("Not yet implemented"); new CvDTree();
} }
public void testGetVarImportance() { public void testGetVarImportance() {

View File

@ -1,11 +1,13 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvEMParams;
public class CvEMParamsTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvEMParamsTest extends TestCase {
super.setUp();
public void testCvEMParams() {
new CvEMParams();
} }
public void testGet_cov_mat_type() { public void testGet_cov_mat_type() {

View File

@ -1,12 +1,10 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvEM;
public class CvEMTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvEMTest extends TestCase {
super.setUp();
}
public void testCalcLikelihood() { public void testCalcLikelihood() {
fail("Not yet implemented"); fail("Not yet implemented");
@ -17,7 +15,7 @@ public class CvEMTest extends OpenCVTestCase {
} }
public void testCvEM() { public void testCvEM() {
fail("Not yet implemented"); new CvEM();
} }
public void testCvEMMat() { public void testCvEMMat() {

View File

@ -1,15 +1,13 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvERTrees;
public class CvERTreesTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvERTreesTest extends TestCase {
super.setUp();
}
public void testCvERTrees() { public void testCvERTrees() {
fail("Not yet implemented"); new CvERTrees();
} }
public void testTrainMatIntMat() { public void testTrainMatIntMat() {

View File

@ -1,11 +1,13 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvGBTreesParams;
public class CvGBTreesParamsTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvGBTreesParamsTest extends TestCase {
super.setUp();
public void testCvGBTreesParams() {
new CvGBTreesParams();
} }
public void testGet_loss_function_type() { public void testGet_loss_function_type() {

View File

@ -1,19 +1,17 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvGBTrees;
public class CvGBTreesTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvGBTreesTest extends TestCase {
super.setUp();
}
public void testClear() { public void testClear() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCvGBTrees() { public void testCvGBTrees() {
fail("Not yet implemented"); new CvGBTrees();
} }
public void testCvGBTreesMatIntMat() { public void testCvGBTreesMatIntMat() {

View File

@ -1,15 +1,13 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvKNearest;
public class CvKNearestTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvKNearestTest extends TestCase {
super.setUp();
}
public void testCvKNearest() { public void testCvKNearest() {
fail("Not yet implemented"); new CvKNearest();
} }
public void testCvKNearestMatMat() { public void testCvKNearestMatMat() {

View File

@ -1,19 +1,17 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvNormalBayesClassifier;
public class CvNormalBayesClassifierTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvNormalBayesClassifierTest extends TestCase {
super.setUp();
}
public void testClear() { public void testClear() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCvNormalBayesClassifier() { public void testCvNormalBayesClassifier() {
fail("Not yet implemented"); new CvNormalBayesClassifier();
} }
public void testCvNormalBayesClassifierMatMat() { public void testCvNormalBayesClassifierMatMat() {

View File

@ -1,11 +1,13 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvParamGrid;
public class CvParamGridTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvParamGridTest extends TestCase {
super.setUp();
public void testCvParamGrid() {
new CvParamGrid();
} }
public void testGet_max_val() { public void testGet_max_val() {

View File

@ -1,11 +1,13 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvRTParams;
public class CvRTParamsTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvRTParamsTest extends TestCase {
super.setUp();
public void testCvRTParams() {
new CvRTParams();
} }
public void testGet_calc_var_importance() { public void testGet_calc_var_importance() {

View File

@ -1,19 +1,17 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvRTrees;
public class CvRTreesTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvRTreesTest extends TestCase {
super.setUp();
}
public void testClear() { public void testClear() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCvRTrees() { public void testCvRTrees() {
fail("Not yet implemented"); new CvRTrees();
} }
public void testGetVarImportance() { public void testGetVarImportance() {

View File

@ -1,11 +1,13 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvSVMParams;
public class CvSVMParamsTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvSVMParamsTest extends TestCase {
super.setUp();
public void testCvSVMParams() {
new CvSVMParams();
} }
public void testGet_C() { public void testGet_C() {

View File

@ -1,19 +1,17 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvSVM;
public class CvSVMTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvSVMTest extends TestCase {
super.setUp();
}
public void testClear() { public void testClear() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCvSVM() { public void testCvSVM() {
fail("Not yet implemented"); new CvSVM();
} }
public void testCvSVMMatMat() { public void testCvSVMMatMat() {

View File

@ -1,11 +1,13 @@
package org.opencv.test.ml; package org.opencv.test.ml;
import org.opencv.test.OpenCVTestCase; import org.opencv.ml.CvStatModel;
public class CvStatModelTest extends OpenCVTestCase { import junit.framework.TestCase;
protected void setUp() throws Exception { public class CvStatModelTest extends TestCase {
super.setUp();
public void testCvStatModel() {
new CvStatModel();
} }
public void testLoadString() { public void testLoadString() {

View File

@ -5,10 +5,6 @@ import org.opencv.test.OpenCVTestCase;
public class HOGDescriptorTest extends OpenCVTestCase { public class HOGDescriptorTest extends OpenCVTestCase {
protected void setUp() throws Exception {
super.setUp();
}
public void testCheckDetectorSize() { public void testCheckDetectorSize() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -173,6 +169,10 @@ public class HOGDescriptorTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testGet_svmDetector() {
fail("Not yet implemented");
}
public void testGet_winSigma() { public void testGet_winSigma() {
fail("Not yet implemented"); fail("Not yet implemented");
} }

View File

@ -6,7 +6,7 @@ import org.opencv.core.Rect;
import org.opencv.objdetect.Objdetect; import org.opencv.objdetect.Objdetect;
import org.opencv.test.OpenCVTestCase; import org.opencv.test.OpenCVTestCase;
public class objdetectTest extends OpenCVTestCase { public class ObjdetectTest extends OpenCVTestCase {
public void testGroupRectanglesListOfRectInt() { public void testGroupRectanglesListOfRectInt() {
Rect r = new Rect(10, 10, 20, 20); Rect r = new Rect(10, 10, 20, 20);
@ -36,6 +36,10 @@ public class objdetectTest extends OpenCVTestCase {
assertEquals(2, rects.size()); assertEquals(2, rects.size());
} }
public void testGroupRectanglesListOfRectIntDoubleListOfIntegerListOfDouble() {
fail("Not yet implemented");
}
public void testGroupRectanglesListOfRectListOfIntegerInt() { public void testGroupRectanglesListOfRectListOfIntegerInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }

View File

@ -1,17 +1,26 @@
package org.opencv.test; package org.opencv.test.utils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.opencv.utils.Converters;
import org.opencv.core.CvType; import org.opencv.core.CvType;
import org.opencv.core.Mat; import org.opencv.core.Mat;
import org.opencv.core.Point; import org.opencv.core.Point;
import org.opencv.core.Rect; import org.opencv.core.Rect;
import org.opencv.features2d.KeyPoint; import org.opencv.features2d.KeyPoint;
import org.opencv.test.OpenCVTestCase;
import org.opencv.utils.Converters;
public class ConvertersTest extends OpenCVTestCase { public class ConvertersTest extends OpenCVTestCase {
public void testMat_to_vector_char() {
fail("Not yet implemented");
}
public void testMat_to_vector_DMatch() {
fail("Not yet implemented");
}
public void testMat_to_vector_float() { public void testMat_to_vector_float() {
Mat src = new Mat(4, 1, CvType.CV_32FC1); Mat src = new Mat(4, 1, CvType.CV_32FC1);
src.put(0, 0, 2, 4, 3, 9); src.put(0, 0, 2, 4, 3, 9);
@ -23,7 +32,7 @@ public class ConvertersTest extends OpenCVTestCase {
truth.add(4.0f); truth.add(4.0f);
truth.add(3.0f); truth.add(3.0f);
truth.add(9.0f); truth.add(9.0f);
assertListFloatEquals(truth, fs, EPS); assertListEquals(truth, fs, EPS);
} }
public void testMat_to_vector_int() { public void testMat_to_vector_int() {
@ -37,7 +46,7 @@ public class ConvertersTest extends OpenCVTestCase {
truth.add(4); truth.add(4);
truth.add(3); truth.add(3);
truth.add(9); truth.add(9);
assertListIntegerEquals(truth, fs); assertListEquals(truth, fs);
} }
public void testMat_to_vector_KeyPoint() { public void testMat_to_vector_KeyPoint() {
@ -81,6 +90,30 @@ public class ConvertersTest extends OpenCVTestCase {
assertListPointEquals(truth, points, EPS); assertListPointEquals(truth, points, EPS);
} }
public void testMat_to_vector_Point2d() {
fail("Not yet implemented");
}
public void testMat_to_vector_Point2f() {
fail("Not yet implemented");
}
public void testMat_to_vector_Point3() {
fail("Not yet implemented");
}
public void testMat_to_vector_Point3d() {
fail("Not yet implemented");
}
public void testMat_to_vector_Point3f() {
fail("Not yet implemented");
}
public void testMat_to_vector_Point3i() {
fail("Not yet implemented");
}
public void testMat_to_vector_Rect() { public void testMat_to_vector_Rect() {
Mat src = new Mat(2, 1, CvType.CV_32SC4); Mat src = new Mat(2, 1, CvType.CV_32SC4);
src.put(0, 0, 2, 2, 5, 2, 0, 0, 6, 4); src.put(0, 0, 2, 2, 5, 2, 0, 0, 6, 4);
@ -93,6 +126,30 @@ public class ConvertersTest extends OpenCVTestCase {
assertListRectEquals(truth, rectangles); assertListRectEquals(truth, rectangles);
} }
public void testMat_to_vector_uchar() {
fail("Not yet implemented");
}
public void testMat_to_vector_vector_char() {
fail("Not yet implemented");
}
public void testMat_to_vector_vector_DMatch() {
fail("Not yet implemented");
}
public void testMat_to_vector_vector_KeyPoint() {
fail("Not yet implemented");
}
public void testVector_char_to_Mat() {
fail("Not yet implemented");
}
public void testVector_DMatch_to_Mat() {
fail("Not yet implemented");
}
public void testVector_double_to_Mat() { public void testVector_double_to_Mat() {
List<Double> inputVector = new ArrayList<Double>(); List<Double> inputVector = new ArrayList<Double>();
inputVector.add(2.0); inputVector.add(2.0);
@ -132,6 +189,10 @@ public class ConvertersTest extends OpenCVTestCase {
assertMatEqual(truth, dst); assertMatEqual(truth, dst);
} }
public void testVector_KeyPoint_to_Mat() {
fail("Not yet implemented");
}
public void testVector_Mat_to_Mat() { public void testVector_Mat_to_Mat() {
// List<Mat> mats = new ArrayList<Mat>(); // List<Mat> mats = new ArrayList<Mat>();
// mats.add(new Mat(2, 1, CvType.CV_32SC1, Scalar.all(2.0))); // mats.add(new Mat(2, 1, CvType.CV_32SC1, Scalar.all(2.0)));
@ -158,6 +219,38 @@ public class ConvertersTest extends OpenCVTestCase {
assertMatEqual(truth, dst); assertMatEqual(truth, dst);
} }
public void testVector_Point_to_MatListOfPoint() {
fail("Not yet implemented");
}
public void testVector_Point_to_MatListOfPointInt() {
fail("Not yet implemented");
}
public void testVector_Point2d_to_Mat() {
fail("Not yet implemented");
}
public void testVector_Point2f_to_Mat() {
fail("Not yet implemented");
}
public void testVector_Point3_to_Mat() {
fail("Not yet implemented");
}
public void testVector_Point3d_to_Mat() {
fail("Not yet implemented");
}
public void testVector_Point3f_to_Mat() {
fail("Not yet implemented");
}
public void testVector_Point3i_to_Mat() {
fail("Not yet implemented");
}
public void testVector_Rect_to_Mat() { public void testVector_Rect_to_Mat() {
List<Rect> rectangles = new ArrayList<Rect>(); List<Rect> rectangles = new ArrayList<Rect>();
rectangles.add(new Rect(2, 2, 5, 2)); rectangles.add(new Rect(2, 2, 5, 2));
@ -186,4 +279,16 @@ public class ConvertersTest extends OpenCVTestCase {
assertMatEqual(truth, dst); assertMatEqual(truth, dst);
} }
public void testVector_vector_char_to_Mat() {
fail("Not yet implemented");
}
public void testVector_vector_DMatch_to_Mat() {
fail("Not yet implemented");
}
public void testVector_vector_KeyPoint_to_Mat() {
fail("Not yet implemented");
}
} }

View File

@ -4,8 +4,12 @@ import org.opencv.test.OpenCVTestCase;
public class BackgroundSubtractorMOGTest extends OpenCVTestCase { public class BackgroundSubtractorMOGTest extends OpenCVTestCase {
protected void setUp() throws Exception { public void testApplyMatMat() {
super.setUp(); fail("Not yet implemented");
}
public void testApplyMatMatDouble() {
fail("Not yet implemented");
} }
public void testBackgroundSubtractorMOG() { public void testBackgroundSubtractorMOG() {

View File

@ -1,19 +0,0 @@
package org.opencv.test.video;
import org.opencv.test.OpenCVTestCase;
public class BackgroundSubtractorTest extends OpenCVTestCase {
protected void setUp() throws Exception {
super.setUp();
}
public void testApplyMatMat() {
fail("Not yet implemented");
}
public void testApplyMatMatDouble() {
fail("Not yet implemented");
}
}

View File

@ -5,10 +5,6 @@ import org.opencv.video.KalmanFilter;
public class KalmanFilterTest extends OpenCVTestCase { public class KalmanFilterTest extends OpenCVTestCase {
protected void setUp() throws Exception {
super.setUp();
}
public void testCorrect() { public void testCorrect() {
fail("Not yet implemented"); fail("Not yet implemented");
} }

View File

@ -11,20 +11,20 @@ import org.opencv.test.OpenCVTestCase;
import org.opencv.utils.Converters; import org.opencv.utils.Converters;
import org.opencv.video.Video; import org.opencv.video.Video;
public class videoTest extends OpenCVTestCase { public class VideoTest extends OpenCVTestCase {
private List<Float> err = null;
private int h;
private List<Point> nextPts = null;
List<Point> prevPts = null;
private int shift1; private int shift1;
private int shift2; private int shift2;
private int w;
private int h;
private List<Byte> status = null;
private Mat subLena1 = null; private Mat subLena1 = null;
private Mat subLena2 = null; private Mat subLena2 = null;
private int w;
List<Point> prevPts = null;
private List<Point> nextPts = null;
private List<Byte> status = null;
private List<Float> err = null;
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
@ -64,24 +64,9 @@ public class videoTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteriaDoubleIntDouble() { public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloat() {
fail("Not yet implemented"); Video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err);
} assertEquals(3, Core.countNonZero(Converters.vector_uchar_to_Mat(status)));
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteriaDoubleInt() {
fail("Not yet implemented");
}
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteriaDouble() {
fail("Not yet implemented");
}
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteria() {
fail("Not yet implemented");
}
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeInt() {
fail("Not yet implemented");
} }
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSize() { public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSize() {
@ -90,9 +75,24 @@ public class videoTest extends OpenCVTestCase {
assertEquals(0, Core.countNonZero(Converters.vector_uchar_to_Mat(status))); assertEquals(0, Core.countNonZero(Converters.vector_uchar_to_Mat(status)));
} }
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloat() { public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeInt() {
Video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err); fail("Not yet implemented");
assertEquals(3, Core.countNonZero( Converters.vector_uchar_to_Mat(status) )); }
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteria() {
fail("Not yet implemented");
}
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteriaDouble() {
fail("Not yet implemented");
}
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteriaDoubleInt() {
fail("Not yet implemented");
}
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteriaDoubleIntDouble() {
fail("Not yet implemented");
} }
public void testCamShift() { public void testCamShift() {

View File

@ -471,6 +471,195 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize
"imshow" : {'j_code' : '', 'jn_code' : '', 'cpp_code' : '' }, "imshow" : {'j_code' : '', 'jn_code' : '', 'cpp_code' : '' },
"waitKey" : {'j_code' : '', 'jn_code' : '', 'cpp_code' : '' }, "waitKey" : {'j_code' : '', 'jn_code' : '', 'cpp_code' : '' },
}, # Highgui }, # Highgui
'CvANN_MLP_TrainParams':
{
"CvANN_MLP_TrainParams" :
{
'j_code' : """
//javadoc:CvANN_MLP_TrainParams::CvANN_MLP_TrainParams()
public CvANN_MLP_TrainParams() {
nativeObj = n_newObj();
}
""",
'jn_code' : 'private static native long n_newObj();',
'cpp_code' : """
JNIEXPORT jlong JNICALL Java_org_opencv_ml_CvANN_1MLP_1TrainParams_n_1newObj
(JNIEnv* env, jclass cls)
{
return (jlong) new CvANN_MLP_TrainParams();
}
"""
},
},
'CvBoostParams':
{
"CvBoostParams" :
{
'j_code' : """
//javadoc:CvBoostParams::CvBoostParams()
public CvBoostParams() {
nativeObj = n_newObj();
}
""",
'jn_code' : 'private static native long n_newObj();',
'cpp_code' : """
JNIEXPORT jlong JNICALL Java_org_opencv_ml_CvBoostParams_n_1newObj
(JNIEnv* env, jclass cls)
{
return (jlong) new CvBoostParams();
}
"""
},
},
'CvDTreeParams':
{
"CvDTreeParams" :
{
'j_code' : """
//javadoc:CvDTreeParams::CvDTreeParams()
public CvDTreeParams() {
nativeObj = n_newObj();
}
""",
'jn_code' : 'private static native long n_newObj();',
'cpp_code' : """
JNIEXPORT jlong JNICALL Java_org_opencv_ml_CvDTreeParams_n_1newObj
(JNIEnv* env, jclass cls)
{
return (jlong) new CvDTreeParams();
}
"""
},
},
'CvEMParams':
{
"CvEMParams" :
{
'j_code' : """
//javadoc:CvEMParams::CvEMParams()
public CvEMParams() {
nativeObj = n_newObj();
}
""",
'jn_code' : 'private static native long n_newObj();',
'cpp_code' : """
JNIEXPORT jlong JNICALL Java_org_opencv_ml_CvEMParams_n_1newObj
(JNIEnv* env, jclass cls)
{
return (jlong) new CvEMParams();
}
"""
},
},
'CvGBTreesParams':
{
"CvGBTreesParams" :
{
'j_code' : """
//javadoc:CvGBTreesParams::CvGBTreesParams()
public CvGBTreesParams() {
nativeObj = n_newObj();
}
""",
'jn_code' : 'private static native long n_newObj();',
'cpp_code' : """
JNIEXPORT jlong JNICALL Java_org_opencv_ml_CvGBTreesParams_n_1newObj
(JNIEnv* env, jclass cls)
{
return (jlong) new CvGBTreesParams();
}
"""
},
},
'CvParamGrid':
{
"CvParamGrid" :
{
'j_code' : """
//javadoc:CvParamGrid::CvParamGrid()
public CvParamGrid() {
nativeObj = n_newObj();
}
""",
'jn_code' : 'private static native long n_newObj();',
'cpp_code' : """
JNIEXPORT jlong JNICALL Java_org_opencv_ml_CvParamGrid_n_1newObj
(JNIEnv* env, jclass cls)
{
return (jlong) new CvParamGrid();
}
"""
},
},
'CvRTParams':
{
"CvRTParams" :
{
'j_code' : """
//javadoc:CvRTParams::CvRTParams()
public CvRTParams() {
nativeObj = n_newObj();
}
""",
'jn_code' : 'private static native long n_newObj();',
'cpp_code' : """
JNIEXPORT jlong JNICALL Java_org_opencv_ml_CvRTParams_n_1newObj
(JNIEnv* env, jclass cls)
{
return (jlong) new CvRTParams();
}
"""
},
},
'CvStatModel':
{
"CvStatModel" :
{
'j_code' : """
//javadoc:CvStatModel::CvStatModel()
public CvStatModel() {
nativeObj = n_newObj();
}
""",
'jn_code' : 'private static native long n_newObj();',
'cpp_code' : """
JNIEXPORT jlong JNICALL Java_org_opencv_ml_CvStatModel_n_1newObj
(JNIEnv* env, jclass cls)
{
return (jlong) new CvStatModel();
}
"""
},
},
'CvSVMParams':
{
"CvSVMParams" :
{
'j_code' : """
//javadoc:CvSVMParams::CvSVMParams()
public CvSVMParams() {
nativeObj = n_newObj();
}
""",
'jn_code' : 'private static native long n_newObj();',
'cpp_code' : """
JNIEXPORT jlong JNICALL Java_org_opencv_ml_CvSVMParams_n_1newObj
(JNIEnv* env, jclass cls)
{
return (jlong) new CvSVMParams();
}
"""
},
},
} }
# { class : { func : {arg_name : ctype} } } # { class : { func : {arg_name : ctype} } }
@ -760,6 +949,16 @@ public class %(jc)s {
else: # function else: # function
self.add_func(decl) self.add_func(decl)
#FIXME: BackgroundSubtractor is merged into BackgroundSubtractorMOG because of inheritance
if "BackgroundSubtractor" in self.classes:
bs = self.classes["BackgroundSubtractor"]
bsmog = self.classes["BackgroundSubtractorMOG"]
for name, mtd in bs.methods.items():
for fn in mtd.funcs:
fn.classname = "BackgroundSubtractorMOG"
bsmog.methods[name] = mtd;
del self.classes["BackgroundSubtractor"]
self.cpp_code = StringIO() self.cpp_code = StringIO()
self.cpp_code.write(""" self.cpp_code.write("""
// //
@ -1131,7 +1330,7 @@ JNIEXPORT $rtype JNICALL Java_org_opencv_${module}_${clazz}_$fname
""" ).substitute( \ """ ).substitute( \
rtype = rtype, \ rtype = rtype, \
module = self.module, \ module = self.module, \
clazz = clazz, \ clazz = clazz.replace('_', '_1'), \
fname = (fi.jname + '_' + str(suffix_counter)).replace('_', '_1'), \ fname = (fi.jname + '_' + str(suffix_counter)).replace('_', '_1'), \
args = ", ".join(["%s %s" % (type_dict[a.ctype].get("jni_type"), a.name) for a in jni_args]), \ args = ", ".join(["%s %s" % (type_dict[a.ctype].get("jni_type"), a.name) for a in jni_args]), \
prologue = "\n ".join(c_prologue), \ prologue = "\n ".join(c_prologue), \