From: Andrey Pavlenko Date: Wed, 21 Mar 2012 15:07:54 +0000 (+0000) Subject: #921 less signatures for func-s with default arg val-s (aka smart overloads); X-Git-Tag: accepted/2.0/20130307.220821~1058 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f13e54dd7232c4a1e7b082fab8c6b40d6dc1dd17;p=profile%2Fivi%2Fopencv.git #921 less signatures for func-s with default arg val-s (aka smart overloads); moving inpaintTest() to 'photo'; hiding 'Point*' arg in Java signature of Core.checkRange(). --- diff --git a/modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java b/modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java index 191f5ee..fc00915 100644 --- a/modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java +++ b/modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java @@ -360,10 +360,10 @@ public class OpenCVTestCase extends TestCase { if (isEqualityMeasured) assertTrue("Max difference between expected and actiual Mats is bigger than " + eps, - Core.checkRange(diff, true, new Point(), 0.0, eps)); + Core.checkRange(diff, true, 0.0, eps)); else assertFalse("Max difference between expected and actiual Mats is less than " + eps, - Core.checkRange(diff, true, new Point(), 0.0, eps)); + Core.checkRange(diff, true, 0.0, eps)); } protected static String readFile(String path) { diff --git a/modules/java/android_test/src/org/opencv/test/core/CoreTest.java b/modules/java/android_test/src/org/opencv/test/core/CoreTest.java index 98ba300..6dd7ebe 100644 --- a/modules/java/android_test/src/org/opencv/test/core/CoreTest.java +++ b/modules/java/android_test/src/org/opencv/test/core/CoreTest.java @@ -31,15 +31,6 @@ public class CoreTest extends OpenCVTestCase { assertMatEqual(gray255, dst); } - public void testAddMatMatMatMat() { - Mat mask = makeMask(gray1.clone()); - dst = gray127.clone(); - - Core.add(gray127, gray1, dst, mask); - - assertMatEqual(makeMask(gray128, 127), dst); - } - public void testAddMatMatMatMatInt() { Core.add(gray0, gray1, dst, gray1, CvType.CV_32F); @@ -186,6 +177,7 @@ public class CoreTest extends OpenCVTestCase { assertMatEqual(expected_angle, dst_angle, EPS * 180/Math.PI); } + public void testCheckRangeMat() { Mat outOfRange = new Mat(2, 2, CvType.CV_64F); outOfRange.put(0, 0, Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 0); @@ -195,35 +187,6 @@ public class CoreTest extends OpenCVTestCase { assertFalse(Core.checkRange(outOfRange)); } - public void testCheckRangeMatBoolean() { - Mat outOfRange = new Mat(2, 2, CvType.CV_64F); - outOfRange.put(0, 0, Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 0); - - assertFalse(Core.checkRange(outOfRange, true)); - - try { - Core.checkRange(outOfRange, false); - fail("Core.checkRange should throw the CvException"); - } catch (CvException e) { - // expected - } - } - - public void testCheckRangeMatBooleanPoint() { - Mat outOfRange = new Mat(2, 3, CvType.CV_64F); - outOfRange.put(0, 0, 1, 2, Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 0); - Point pt = new Point(); - - assertFalse(Core.checkRange(outOfRange, true, null)); - assertFalse(Core.checkRange(outOfRange, true, pt)); - - assertPointEquals(new Point(2, 0), pt, EPS); - } - - public void testCheckRangeMatBooleanPointDouble() { - assertFalse(Core.checkRange(gray255, true, null, 256)); - assertTrue(Core.checkRange(gray0, true, null, 0)); - } public void testCheckRangeMatBooleanPointDoubleDouble() { Mat inRange = new Mat(2, 3, CvType.CV_64F) { @@ -232,7 +195,7 @@ public class CoreTest extends OpenCVTestCase { } }; - assertTrue(Core.checkRange(inRange, true, null, 5, 100)); + assertTrue(Core.checkRange(inRange, true, 5, 100)); Mat outOfRange = new Mat(2, 3, CvType.CV_64F) { { @@ -240,9 +203,9 @@ public class CoreTest extends OpenCVTestCase { } }; - assertFalse(Core.checkRange(outOfRange, true, null, 5, 100)); + assertFalse(Core.checkRange(outOfRange, true, 5, 100)); } - + public void testCircleMatPointIntScalar() { Point center = new Point(gray0.cols() / 2, gray0.rows() / 2); int radius = Math.min(gray0.cols() / 4, gray0.rows() / 4); @@ -263,16 +226,6 @@ public class CoreTest extends OpenCVTestCase { assertTrue(0 != Core.countNonZero(gray0)); } - public void testCircleMatPointIntScalarIntInt() { - Point center = new Point(gray0.cols() / 2, gray0.rows() / 2); - int radius = Math.min(gray0.cols() / 4, gray0.rows() / 4); - Scalar color = new Scalar(128); - - Core.circle(gray0, center, radius, color, 2, Core.LINE_4); - - assertTrue(0 != Core.countNonZero(gray0)); - } - public void testCircleMatPointIntScalarIntIntInt() { Point center = new Point(gray0.cols() / 2, gray0.rows() / 2); Point center2 = new Point(gray0.cols(), gray0.rows()); @@ -359,16 +312,6 @@ public class CoreTest extends OpenCVTestCase { assertMatEqual(gray255, dst, EPS); } - public void testConvertScaleAbsMatMatDouble() { - Core.convertScaleAbs(gray0, dst, 2); - - assertMatEqual(gray0, dst); - - Core.convertScaleAbs(gray_16u_256, dst, 2); - - assertMatEqual(gray255, dst); - } - public void testConvertScaleAbsMatMatDoubleDouble() { Core.convertScaleAbs(gray_16u_256, dst, 2, -513); @@ -453,32 +396,6 @@ public class CoreTest extends OpenCVTestCase { assertMatEqual(gray0_32f_1d, dst, EPS); } - public void testDftMatMatInt() { - Mat src = new Mat(1, 4, CvType.CV_32F) { - { - put(0, 0, 1, 2, 3, 4); - } - }; - - Core.dft(src, dst, Core.DFT_REAL_OUTPUT); - - truth = new Mat(1, 4, CvType.CV_32F) { - { - put(0, 0, 10, -2, 2, -2); - } - }; - assertMatEqual(truth, dst, EPS); - - Core.dft(src, dst, Core.DFT_INVERSE); - - truth = new Mat(1, 4, CvType.CV_32F) { - { - put(0, 0, 9, -9, 1, 3); - } - }; - assertMatEqual(truth, dst, EPS); - } - public void testDftMatMatIntInt() { Mat src1 = new Mat(2, 4, CvType.CV_32F) { { @@ -609,16 +526,6 @@ public class CoreTest extends OpenCVTestCase { assertTrue(0 != Core.countNonZero(gray0)); } - public void testEllipseMatPointSizeDoubleDoubleDoubleScalarIntInt() { - Point center = new Point(gray0.cols() / 2, gray0.rows() / 2); - Size axes = new Size(2, 2); - double angle = 30, startAngle = 0, endAngle = 30; - - Core.ellipse(gray0, center, axes, angle, startAngle, endAngle, colorWhite, Core.FILLED, Core.LINE_4); - - assertTrue(0 != Core.countNonZero(gray0)); - } - public void testEllipseMatPointSizeDoubleDoubleDoubleScalarIntIntInt() { Point center = new Point(gray0.cols() / 2, gray0.rows() / 2); Size axes = new Size(2, 2); @@ -718,16 +625,6 @@ public class CoreTest extends OpenCVTestCase { assertTrue(gray0.total() > Core.countNonZero(gray0)); } - public void testFillConvexPolyMatListOfPointScalarInt() { - List polyline = Arrays.asList(new Point(1, 1), new Point(5, 0), new Point(6, 8), new Point(0, 9)); - - Core.fillConvexPoly(gray0, polyline, new Scalar(150), Core.LINE_8); - Core.fillConvexPoly(gray0, polyline, new Scalar(0), Core.LINE_4); - - assertTrue(0 < Core.countNonZero(gray0)); - assertTrue(gray0.total() > Core.countNonZero(gray0)); - } - public void testFillConvexPolyMatListOfPointScalarIntInt() { List polyline1 = Arrays.asList(new Point(2, 1), new Point(5, 1), new Point(5, 7), new Point(2, 7)); List polyline2 = Arrays.asList(new Point(4, 2), new Point(10, 2), new Point(10, 14), new Point(4, 14)); @@ -773,36 +670,6 @@ public class CoreTest extends OpenCVTestCase { }, gray0); } - public void testFillPolyMatListOfListOfPointScalarInt() { - List polyline = Arrays.asList(new Point(1, 4), new Point(1, 8), new Point(4, 1), new Point(7, 8), new Point(9, 3)); - List> polylines = new ArrayList>(); - polylines.add(polyline); - - Core.fillPoly(gray0, polylines, new Scalar(1), Core.LINE_8); - Core.fillPoly(gray0, polylines, new Scalar(0), Core.LINE_4); - - assertTrue(0 < Core.countNonZero(gray0)); - } - - public void testFillPolyMatListOfListOfPointScalarIntInt() { - List polyline1 = Arrays.asList(new Point(1, 4), new Point(1, 8), new Point(4, 1), new Point(7, 8), new Point(7, 4)); - List polyline2 = Arrays.asList(new Point(2, 8), new Point(2, 16), new Point(8, 2), new Point(14, 16), new Point(14, 8)); - - List> polylines1 = new ArrayList>(); - polylines1.add(polyline1); - - List> polylines2 = new ArrayList>(); - polylines2.add(polyline2); - - Core.fillPoly(gray0, polylines1, new Scalar(1), Core.LINE_8, 0); - - assertTrue(0 < Core.countNonZero(gray0)); - - Core.fillPoly(gray0, polylines2, new Scalar(0), Core.LINE_8, 1); - - assertEquals(0, Core.countNonZero(gray0)); - } - public void testFillPolyMatListOfListOfPointScalarIntIntPoint() { List polyline1 = Arrays.asList(new Point(1, 4), new Point(1, 8), new Point(4, 1), new Point(7, 8), new Point(7, 4)); List polyline2 = Arrays.asList(new Point(0, 3), new Point(0, 7), new Point(3, 0), new Point(6, 7), new Point(6, 3)); @@ -1037,23 +904,6 @@ public class CoreTest extends OpenCVTestCase { assertMatEqual(truth, dst, EPS); } - public void testIdftMatMatInt() { - Mat in = new Mat(1, 4, CvType.CV_32F) { - { - put(0, 0, 1.0, 2.0, 3.0, 4.0); - } - }; - - Core.idft(in, dst, Core.DFT_SCALE); - - truth = new Mat(1, 4, CvType.CV_32F) { - { - put(0, 0, 2.25, -2.25, 0.25, 0.75); - } - }; - assertMatEqual(truth, dst, EPS); - } - public void testIdftMatMatIntInt() { Mat in = new Mat(2, 4, CvType.CV_32F) { { @@ -1211,20 +1061,6 @@ public class CoreTest extends OpenCVTestCase { assertTrue(nPoints == Core.countNonZero(gray0)); } - public void testLineMatPointPointScalarIntInt() { - int nPoints = Math.min(gray0.cols(), gray0.rows()); - Point point1 = new Point(0, 3); - Point point2 = new Point(nPoints, nPoints); - - Core.line(gray0, point2, point1, colorWhite, 2, Core.LINE_AA); - - assertFalse(0 == Core.countNonZero(gray0)); - - Core.line(gray0, point2, point1, colorBlack, 2, Core.LINE_4); - - assertFalse(0 == Core.countNonZero(gray0)); - } - public void testLineMatPointPointScalarIntIntInt() { int nPoints = Math.min(gray0.cols(), gray0.rows()); Point point1 = new Point(3, 4); @@ -1535,12 +1371,6 @@ public class CoreTest extends OpenCVTestCase { assertMatEqual(grayE_32f, dst, EPS); } - public void testMulTransposedMatMatBooleanMat() { - Core.mulTransposed(grayRnd_32f, dst, false, grayRnd_32f); - - assertMatEqual(gray0_32f, dst, EPS); - } - public void testMulTransposedMatMatBooleanMatDouble() { Core.mulTransposed(grayE_32f, dst, true, gray0_32f, 2); @@ -1566,23 +1396,6 @@ public class CoreTest extends OpenCVTestCase { assertMatEqual(gray0, dst); } - public void testNormalizeMatMatDouble() { - Mat m = gray0; - m.diag().setTo(new Scalar(1)); - - Core.normalize(m, dst, 255); - - truth = Mat.eye(matSize, matSize, CvType.CV_8U); - truth.diag().setTo(new Scalar(81)); - assertMatEqual(truth, dst); - } - - public void testNormalizeMatMatDoubleDouble() { - Core.normalize(gray0, dst, 0.0, 1.0); - // TODO: ban this overload - assertMatEqual(gray0, dst); - } - public void testNormalizeMatMatDoubleDoubleInt() { Mat src = new Mat(1, 4, CvType.CV_32F) { { @@ -1953,16 +1766,6 @@ public class CoreTest extends OpenCVTestCase { assertEquals(62, Core.countNonZero(img)); } - public void testPolylinesMatListOfListOfPointBooleanScalarIntInt() { - Mat img = gray0; - List> polyline = new ArrayList>(); - polyline.add(Arrays.asList(new Point(1, 1), new Point(4, 1), new Point(3, 6), new Point(1, 3))); - - Core.polylines(img, polyline, true, new Scalar(100), 2, Core.LINE_4); - - assertEquals(36, Core.countNonZero(img)); - } - public void testPolylinesMatListOfListOfPointBooleanScalarIntIntInt() { Mat img = gray0; List> polyline1 = new ArrayList>(); @@ -2013,21 +1816,6 @@ public class CoreTest extends OpenCVTestCase { assertEquals(0, Core.countNonZero(img)); } - public void testPutTextMatStringPointIntDoubleScalarIntInt() { - String text = "Hello World"; - Size labelSize = new Size(175, 22); - - Mat img = new Mat(20 + (int) labelSize.height, 20 + (int) labelSize.width, CvType.CV_8U, colorBlack); - Point origin = new Point(10, labelSize.height + 10); - - Core.putText(img, text, origin, Core.FONT_HERSHEY_SIMPLEX, 1.0, colorWhite, 1, Core.LINE_AA); - - assertTrue(Core.countNonZero(img) > 0); - // check that text differs from 8-connected line - Core.putText(img, text, origin, Core.FONT_HERSHEY_SIMPLEX, 1.0, colorBlack, 1, Core.LINE_8); - assertFalse(0 == Core.countNonZero(img)); - } - public void testPutTextMatStringPointIntDoubleScalarIntIntBoolean() { String text = "Hello World"; Size labelSize = new Size(175, 22); @@ -2087,8 +1875,8 @@ public class CoreTest extends OpenCVTestCase { public void testRandu() { Core.randu(gray0, 3, 23); - - assertTrue(Core.checkRange(gray0, true, null, 3, 23)); + fail("Not yet implemented"); + //assertTrue(Core.checkRange(gray0, true, null, 3, 23)); } public void testRectangleMatPointPointScalar() { @@ -2117,8 +1905,8 @@ public class CoreTest extends OpenCVTestCase { Point topLeft = new Point(0, 0); Scalar color = new Scalar(128); - Core.rectangle(gray0, bottomRight, topLeft, color, 2, Core.LINE_AA); - Core.rectangle(gray0, bottomRight, topLeft, colorBlack, 2, Core.LINE_4); + Core.rectangle(gray0, bottomRight, topLeft, color, 2, Core.LINE_AA, 0); + Core.rectangle(gray0, bottomRight, topLeft, colorBlack, 2, Core.LINE_4, 0); assertTrue(0 != Core.countNonZero(gray0)); } @@ -2133,7 +1921,7 @@ public class CoreTest extends OpenCVTestCase { assertTrue(0 != Core.countNonZero(gray0)); - Core.rectangle(gray0, bottomRight2, topLeft, colorBlack, 2, Core.LINE_8); + Core.rectangle(gray0, bottomRight2, topLeft, colorBlack, 2, Core.LINE_8, 0); assertEquals(0, Core.countNonZero(gray0)); } diff --git a/modules/java/android_test/src/org/opencv/test/features2d/Features2dTest.java b/modules/java/android_test/src/org/opencv/test/features2d/Features2dTest.java index bdaf4ef..0d21961 100644 --- a/modules/java/android_test/src/org/opencv/test/features2d/Features2dTest.java +++ b/modules/java/android_test/src/org/opencv/test/features2d/Features2dTest.java @@ -124,7 +124,7 @@ public class Features2dTest extends OpenCVTestCase { points2.add(queryKeypoints.get(match.queryIdx).pt); } - Mat hmg = Calib3d.findHomography(points1, points2, Calib3d.RANSAC); + Mat hmg = Calib3d.findHomography(points1, points2, Calib3d.RANSAC, 3); assertMatEqual(Mat.eye(3, 3, CvType.CV_64F), hmg, EPS); diff --git a/modules/java/android_test/src/org/opencv/test/imgproc/ImgprocTest.java b/modules/java/android_test/src/org/opencv/test/imgproc/ImgprocTest.java index a566e66..fbf62c3 100644 --- a/modules/java/android_test/src/org/opencv/test/imgproc/ImgprocTest.java +++ b/modules/java/android_test/src/org/opencv/test/imgproc/ImgprocTest.java @@ -5,7 +5,6 @@ import java.util.Arrays; import java.util.List; import org.opencv.core.Core; -import org.opencv.core.CvException; import org.opencv.core.CvType; import org.opencv.core.Mat; import org.opencv.core.Point; @@ -224,12 +223,6 @@ public class ImgprocTest extends OpenCVTestCase { // TODO_: write better test } - public void testBoxFilterMatMatIntSizePoint() { - Imgproc.boxFilter(gray0, dst, 8, size, anchorPoint); - assertMatEqual(gray0, dst); - // TODO_: write better test - } - public void testBoxFilterMatMatIntSizePointBoolean() { Imgproc.boxFilter(gray255, dst, 8, size, anchorPoint, false); assertMatEqual(gray255, dst); @@ -316,12 +309,6 @@ public class ImgprocTest extends OpenCVTestCase { // TODO_: write better test } - public void testCannyMatMatDoubleDoubleInt() { - Imgproc.Canny(gray255, dst, 5, 10, 5); - assertMatEqual(gray0, dst); - // TODO_: write better test - } - public void testCannyMatMatDoubleDoubleIntBoolean() { Imgproc.Canny(gray0, dst, 5, 10, 5, true); assertMatEqual(gray0, dst); @@ -400,17 +387,6 @@ public class ImgprocTest extends OpenCVTestCase { assertMatEqual(expHull, dst, EPS); } - public void testConvexHullMatMatBoolean() { - Mat points = new Mat(1, 6, CvType.CV_32FC2); - points.put(0, 0, 2, 0, 4, 0, 3, 2, 0, 2, 2, 1, 3, 1); - - Imgproc.convexHull(points, dst, true); - - Mat expHull = new Mat(4, 1, CvType.CV_32FC2); - expHull.put(0, 0, 0, 2, 3, 2, 4, 0, 2, 0); - assertMatEqual(expHull, dst, EPS); - } - public void testConvexHullMatMatBooleanBoolean() { Mat points = new Mat(1, 6, CvType.CV_32FC2); points.put(0, 0, 2, 0, 4, 0, 3, 2, 0, 2, 2, 1, 3, 1); @@ -638,23 +614,6 @@ public class ImgprocTest extends OpenCVTestCase { assertEquals(0, Core.countNonZero(gray0)); } - public void testDrawContoursMatListOfMatIntScalarIntInt() { - Core.rectangle(gray0, new Point(1, 2), new Point(7, 8), new Scalar(100)); - List contours = new ArrayList(); - Imgproc.findContours(gray0, contours, new Mat(), Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE); - - Imgproc.drawContours(gray0, contours, -1, new Scalar(0), Core.FILLED, Core.LINE_8); - - assertEquals(0, Core.countNonZero(gray0)); - } - - public void testDrawContoursMatListOfMatIntScalarIntIntMat() { - fail("Not yet implemented"); - } - - public void testDrawContoursMatListOfMatIntScalarIntIntMatInt() { - fail("Not yet implemented"); - } public void testDrawContoursMatListOfMatIntScalarIntIntMatIntPoint() { fail("Not yet implemented"); @@ -677,22 +636,6 @@ public class ImgprocTest extends OpenCVTestCase { assertMatEqual(gray128, dst); } - public void testErodeMatMatMatPoint() { - Mat src = new Mat(3, 3, CvType.CV_8U) { - { - put(0, 0, 1, 4, 8); - put(1, 0, 2, 0, 1); - put(2, 0, 3, 4, 6); - } - }; - Mat kernel = new Mat(); - - Imgproc.erode(src, dst, kernel, anchorPoint); - - truth = new Mat(3, 3, CvType.CV_8U, new Scalar(0)); - assertMatEqual(truth, dst); - } - public void testErodeMatMatMatPointInt() { Mat src = new Mat(3, 3, CvType.CV_8U) { { @@ -709,22 +652,6 @@ public class ImgprocTest extends OpenCVTestCase { assertMatEqual(truth, dst); } - public void testErodeMatMatMatPointIntInt() { - Mat src = new Mat(3, 3, CvType.CV_8U) { - { - put(0, 0, 15, 9, 10); - put(1, 0, 10, 8, 12); - put(2, 0, 12, 20, 25); - } - }; - Mat kernel = new Mat(); - - Imgproc.erode(src, dst, kernel, anchorPoint, 10, Imgproc.BORDER_REFLECT); - - truth = new Mat(3, 3, CvType.CV_8U, new Scalar(8)); - assertMatEqual(truth, dst); - } - public void testErodeMatMatMatPointIntIntScalar() { Mat src = new Mat(3, 3, CvType.CV_8U) { { @@ -759,15 +686,6 @@ public class ImgprocTest extends OpenCVTestCase { assertMatEqual(truth, dst, EPS); } - public void testFilter2DMatMatIntMatPoint() { - Mat kernel = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(1)); - Point point = new Point(0, 0); - - Imgproc.filter2D(gray128, dst, -1, kernel, point); - - assertMatEqual(gray255, dst); - } - public void testFilter2DMatMatIntMatPointDouble() { fail("Not yet implemented"); } @@ -792,7 +710,7 @@ public class ImgprocTest extends OpenCVTestCase { assertEquals(contours.size(), 0); assertEquals(contours.size(), hierarchy.total()); - Core.rectangle(img, new Point(10, 20), new Point(20, 30), new Scalar(100), 3, Core.LINE_AA); + Core.rectangle(img, new Point(10, 20), new Point(20, 30), new Scalar(100), 3, Core.LINE_AA, 0); 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); @@ -809,7 +727,7 @@ public class ImgprocTest extends OpenCVTestCase { List contours2 = new ArrayList(); Mat hierarchy = new Mat(); - Core.rectangle(img, new Point(10, 20), new Point(20, 30), new Scalar(100), 3, Core.LINE_AA); + Core.rectangle(img, new Point(10, 20), new Point(20, 30), new Scalar(100), 3, Core.LINE_AA, 0); 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); @@ -932,14 +850,6 @@ public class ImgprocTest extends OpenCVTestCase { assertEquals(0, Core.countNonZero(mtx)); } - public void testGetDefaultNewCameraMatrixMatSize() { - Mat mtx = Imgproc.getDefaultNewCameraMatrix(gray0, size); - - assertFalse(mtx.empty()); - assertEquals(0, Core.countNonZero(mtx)); - // TODO_: write better test - } - public void testGetDefaultNewCameraMatrixMatSizeBoolean() { Mat mtx = Imgproc.getDefaultNewCameraMatrix(gray0, size, true); @@ -966,25 +876,6 @@ public class ImgprocTest extends OpenCVTestCase { assertMatEqual(expKy, ky, EPS); } - public void testGetDerivKernelsMatMatIntIntIntBoolean() { - Mat kx = new Mat(imgprocSz, imgprocSz, CvType.CV_32F); - Mat ky = new Mat(imgprocSz, imgprocSz, CvType.CV_32F); - Mat expKx = new Mat(3, 1, CvType.CV_32F); - Mat expKy = new Mat(3, 1, CvType.CV_32F); - kx.put(0, 0, 1, 1); - kx.put(1, 0, 1, 1); - ky.put(0, 0, 2, 2); - ky.put(1, 0, 2, 2); - expKx.put(0, 0, 1, -2, 1); - expKy.put(0, 0, 1, -2, 1); - - Imgproc.getDerivKernels(kx, ky, 2, 2, 3, true); - - assertMatEqual(expKx, kx, EPS); - assertMatEqual(expKy, ky, EPS); - // TODO_: write better test - } - public void testGetDerivKernelsMatMatIntIntIntBooleanInt() { Mat kx = new Mat(imgprocSz, imgprocSz, CvType.CV_32F); Mat ky = new Mat(imgprocSz, imgprocSz, CvType.CV_32F); @@ -1089,41 +980,6 @@ public class ImgprocTest extends OpenCVTestCase { assertEquals(4, lp.size()); } - public void testGoodFeaturesToTrackMatListOfPointIntDoubleDoubleMat() { - Mat src = gray128; - Point tl = new Point(2, 2); - Point br = new Point(8, 8); - Scalar color = new Scalar(100); - Core.rectangle(src, tl, br, color, -1); - Mat mask = gray0; - Core.circle(mask, tl, 3, color, -1); - List lp = new ArrayList(); - - Imgproc.goodFeaturesToTrack(src, lp, 100, 0.01, 3, mask); - - assertEquals(1, lp.size()); - } - - public void testGoodFeaturesToTrackMatListOfPointIntDoubleDoubleMatInt() { - Mat src = gray0; - Core.rectangle(src, new Point(2, 2), new Point(8, 8), new Scalar(100), -1); - List lp = new ArrayList(); - - Imgproc.goodFeaturesToTrack(src, lp, 100, 0.01, 3, gray1, 4); - - assertEquals(4, lp.size()); - } - - public void testGoodFeaturesToTrackMatListOfPointIntDoubleDoubleMatIntBoolean() { - Mat src = gray0; - Core.rectangle(src, new Point(2, 2), new Point(8, 8), new Scalar(100), -1); - List lp = new ArrayList(); - - Imgproc.goodFeaturesToTrack(src, lp, 100, 0.01, 3, gray1, 4, true); - - assertEquals(4, lp.size()); - } - public void testGoodFeaturesToTrackMatListOfPointIntDoubleDoubleMatIntBooleanDouble() { Mat src = gray0; Core.rectangle(src, new Point(2, 2), new Point(8, 8), new Scalar(100), -1); @@ -1166,64 +1022,6 @@ public class ImgprocTest extends OpenCVTestCase { assertEquals(1, circles.cols()); } - public void testHoughCirclesMatMatIntDoubleDoubleDouble() { - int sz = 512; - Mat img = new Mat(sz, sz, CvType.CV_8U, new Scalar(128)); - Mat circles = new Mat(); - double param1 = 50; - - Imgproc.HoughCircles(img, circles, Imgproc.CV_HOUGH_GRADIENT, 2, img.rows() / 4, param1); - - assertEquals(0, circles.cols()); - } - - public void testHoughCirclesMatMatIntDoubleDoubleDouble1() { - int sz = 512; - Mat img = new Mat(sz, sz, CvType.CV_8U, new Scalar(128)); - Mat circles = new Mat(); - double param1 = 50; - - Point center = new Point(img.cols() / 2, img.rows() / 2); - int radius = Math.min(img.cols() / 4, img.rows() / 4); - Core.circle(img, center, radius, colorBlack, 3); - - Imgproc.HoughCircles(img, circles, Imgproc.CV_HOUGH_GRADIENT, 2, img.rows() / 4, param1); - - assertEquals(1, circles.cols()); - } - - public void testHoughCirclesMatMatIntDoubleDoubleDoubleDouble() { - int sz = 512; - Mat img = new Mat(sz, sz, CvType.CV_8U, new Scalar(128)); - Mat circles = new Mat(); - double param1 = 50; - double param2 = 100; - - Imgproc.HoughCircles(img, circles, Imgproc.CV_HOUGH_GRADIENT, 2, img.rows() / 4, param1, param2); - - assertEquals(0, circles.cols()); - } - - public void testHoughCirclesMatMatIntDoubleDoubleDoubleDouble1() { - int sz = 512; - Mat img = new Mat(sz, sz, CvType.CV_8U, new Scalar(128)); - Mat circles = new Mat(); - double param1 = 50; - double param2 = 100; - - Point center = new Point(img.cols() / 2, img.rows() / 2); - int radius = Math.min(img.cols() / 4, img.rows() / 4); - Core.circle(img, center, radius, colorBlack, 3); - - Imgproc.HoughCircles(img, circles, Imgproc.CV_HOUGH_GRADIENT, 2, img.rows() / 4, param1, param2); - - assertEquals(1, circles.cols()); - } - - public void testHoughCirclesMatMatIntDoubleDoubleDoubleDoubleInt() { - fail("Not yet implemented"); - } - public void testHoughCirclesMatMatIntDoubleDoubleDoubleDoubleIntInt() { fail("Not yet implemented"); } @@ -1339,17 +1137,6 @@ public class ImgprocTest extends OpenCVTestCase { fail("Not yet implemented"); } - /* - public void testInpaint() { - Core.circle(gray255, new Point(matSize / 2, matSize / 2), 2, colorBlack, Core.FILLED); - Core.circle(gray0, new Point(matSize / 2, matSize / 2), 2, colorWhite, Core.FILLED); - - Imgproc.inpaint(gray255, gray0, dst, 3, Imgproc.INPAINT_TELEA); - - assertMatEqual(getMat(CvType.CV_8U, 255), dst); - } - */ - public void testIntegral2MatMatMat() { Mat src = new Mat(3, 3, CvType.CV_32F, new Scalar(3)); Mat expSum = new Mat(4, 4, CvType.CV_64F); @@ -1501,29 +1288,6 @@ public class ImgprocTest extends OpenCVTestCase { assertMatEqual(gray0, dst); } - public void testLaplacianMatMatIntInt() { - Mat src = new Mat(3, 3, CvType.CV_32F, new Scalar(2)); - truth = new Mat(3, 3, CvType.CV_32F, new Scalar(0)); - - Imgproc.Laplacian(src, dst, CvType.CV_32F, 1); - - assertMatEqual(truth, dst, EPS); - } - - public void testLaplacianMatMatIntIntDouble() { - Mat src = Mat.eye(imgprocSz, imgprocSz, CvType.CV_32F); - - Imgproc.Laplacian(src, dst, CvType.CV_32F, 1, 2); - - truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F) { - { - put(0, 0, -8, 8); - put(1, 0, 8, -8); - } - }; - assertMatEqual(truth, dst, EPS); - } - public void testLaplacianMatMatIntIntDoubleDouble() { Mat src = Mat.eye(imgprocSz, imgprocSz, CvType.CV_32F); @@ -1625,18 +1389,6 @@ public class ImgprocTest extends OpenCVTestCase { // TODO_: write better test } - public void testMorphologyExMatMatIntMatPoint() { - Mat src = Mat.eye(imgprocSz, imgprocSz, CvType.CV_8U); - Mat kernel = new Mat(imgprocSz, imgprocSz, CvType.CV_8U, new Scalar(0)); - Point point = new Point(0, 0); - - Imgproc.morphologyEx(src, dst, Imgproc.MORPH_OPEN, kernel, point); - - truth = Mat.eye(imgprocSz, imgprocSz, CvType.CV_8U); - assertMatEqual(truth, dst); - // TODO_: write better test - } - public void testMorphologyExMatMatIntMatPointInt() { Mat src = Mat.eye(imgprocSz, imgprocSz, CvType.CV_8U); @@ -1650,23 +1402,6 @@ public class ImgprocTest extends OpenCVTestCase { // TODO_: write better test } - public void testMorphologyExMatMatIntMatPointIntInt() { - Mat src = new Mat(imgprocSz, imgprocSz, CvType.CV_8U); - src.put(0, 0, 2, 1); - src.put(1, 0, 2, 1); - Mat kernel = new Mat(imgprocSz, imgprocSz, CvType.CV_8U, new Scalar(1)); - Point point = new Point(1, 1); - - Imgproc.morphologyEx(src, dst, Imgproc.MORPH_TOPHAT, kernel, point, 10, Imgproc.BORDER_REFLECT); - - truth = new Mat(imgprocSz, imgprocSz, CvType.CV_8U) { - { - put(0, 0, 1, 0); - put(1, 0, 1, 0); - } - }; - assertMatEqual(truth, dst); - } public void testMorphologyExMatMatIntMatPointIntIntScalar() { Mat src = new Mat(imgprocSz, imgprocSz, CvType.CV_8U); @@ -1818,22 +1553,6 @@ public class ImgprocTest extends OpenCVTestCase { assertMatEqual(truth, dst, EPS); } - public void testRemapMatMatMatMatIntInt() { - fail("Not yet implemented"); - // this test does something weird - Mat src = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(2)); - Mat map1 = new Mat(1, 3, CvType.CV_32FC1); - Mat map2 = new Mat(1, 3, CvType.CV_32FC1); - - map1.put(0, 0, 3, 6, 5, 0); - map2.put(0, 0, 4, 8, 12); - - truth = new Mat(1, 3, CvType.CV_32F, new Scalar(2)); - - Imgproc.remap(src, dst, map1, map2, Imgproc.INTER_LINEAR, Imgproc.BORDER_REFLECT); - assertMatEqual(truth, dst, EPS); - } - public void testRemapMatMatMatMatIntIntScalar() { fail("Not yet implemented"); // this test does something weird @@ -1862,22 +1581,6 @@ public class ImgprocTest extends OpenCVTestCase { assertMatEqual(truth, dst); } - public void testResizeMatMatSizeDouble() { - try { - Imgproc.resize(gray255, dst, new Size(), 0.5); - fail("Expected CvException was not thrown"); - } catch (CvException e) { - // expected - } - } - - public void testResizeMatMatSizeDoubleDouble() { - Imgproc.resize(gray255, dst, new Size(), 0.5, 0.5); - - truth = new Mat((int) (matSize * 0.5), (int) (matSize * 0.5), CvType.CV_8U, new Scalar(255)); - assertMatEqual(truth, dst); - } - public void testResizeMatMatSizeDoubleDoubleInt() { Imgproc.resize(gray255, dst, new Size(2, 2), 0, 0, Imgproc.INTER_AREA); @@ -1895,16 +1598,6 @@ public class ImgprocTest extends OpenCVTestCase { assertMatEqual(truth, dst, EPS); } - public void testScharrMatMatIntIntIntDouble() { - Mat src = Mat.eye(imgprocSz, imgprocSz, CvType.CV_32F); - - Imgproc.Scharr(src, dst, CvType.CV_32F, 0, 1, 1.5); - - truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(0)); - assertMatEqual(truth, dst, EPS); - // TODO_: write better test - } - public void testScharrMatMatIntIntIntDoubleDouble() { Mat src = Mat.eye(imgprocSz, imgprocSz, CvType.CV_32F); @@ -1942,20 +1635,6 @@ public class ImgprocTest extends OpenCVTestCase { assertMatEqual(truth, dst, EPS); } - public void testSepFilter2DMatMatIntMatMatPoint() { - Mat src = new Mat(imgprocSz, imgprocSz, CvType.CV_32FC1, new Scalar(2)); - Mat kernelX = new Mat(1, 3, CvType.CV_32FC1); - Mat kernelY = new Mat(1, 3, CvType.CV_32FC1); - kernelX.put(0, 0, 2, 2, 2); - kernelY.put(0, 0, 1, 1, 1); - - Imgproc.sepFilter2D(src, dst, CvType.CV_32F, kernelX, kernelY, anchorPoint); - - truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(36)); - assertMatEqual(truth, dst, EPS); - // TODO_: write better test - } - public void testSepFilter2DMatMatIntMatMatPointDouble() { Mat src = new Mat(imgprocSz, imgprocSz, CvType.CV_32FC1, new Scalar(2)); Mat kernelX = new Mat(1, 3, CvType.CV_32FC1); @@ -1989,34 +1668,6 @@ public class ImgprocTest extends OpenCVTestCase { assertMatEqual(gray0, dst); } - public void testSobelMatMatIntIntIntInt() { - Imgproc.Sobel(gray255, dst, CvType.CV_8U, 1, 0, 3); - - assertMatEqual(gray0, dst); - // TODO_: write better test - } - - public void testSobelMatMatIntIntIntIntDouble() { - Mat src = new Mat(3, 3, CvType.CV_32F) { - { - put(0, 0, 2, 0, 1); - put(1, 0, 3, 0, -10); - put(2, 0, -4, 0, 3); - } - }; - - Imgproc.Sobel(src, dst, CvType.CV_32F, 1, 0, 3, 2); - - truth = new Mat(3, 3, CvType.CV_32F) { - { - put(0, 0, 0, -56, 0); - put(1, 0, 0, -40, 0); - put(2, 0, 0, -24, 0); - } - }; - assertMatEqual(truth, dst, EPS); - } - public void testSobelMatMatIntIntIntIntDoubleDouble() { Imgproc.Sobel(gray255, dst, CvType.CV_8U, 1, 0, 3, 2, 0.001); assertMatEqual(gray0, dst); diff --git a/modules/java/android_test/src/org/opencv/test/objdetect/CascadeClassifierTest.java b/modules/java/android_test/src/org/opencv/test/objdetect/CascadeClassifierTest.java index 6a993c0..ae21aac 100644 --- a/modules/java/android_test/src/org/opencv/test/objdetect/CascadeClassifierTest.java +++ b/modules/java/android_test/src/org/opencv/test/objdetect/CascadeClassifierTest.java @@ -40,7 +40,7 @@ public class CascadeClassifierTest extends OpenCVTestCase { Imgproc.cvtColor(rgbLena, greyLena, Imgproc.COLOR_RGB2GRAY); // TODO: doesn't detect with 1.1 scale - cc.detectMultiScale(greyLena, faces, 1.09, 3, Objdetect.CASCADE_SCALE_IMAGE, new Size(30, 30)); + cc.detectMultiScale(greyLena, faces, 1.09, 3, Objdetect.CASCADE_SCALE_IMAGE, new Size(30, 30), new Size()); assertEquals(1, faces.size()); } diff --git a/modules/java/android_test/src/org/opencv/test/photo/PhotoTest.java b/modules/java/android_test/src/org/opencv/test/photo/PhotoTest.java new file mode 100644 index 0000000..c037033 --- /dev/null +++ b/modules/java/android_test/src/org/opencv/test/photo/PhotoTest.java @@ -0,0 +1,21 @@ +package org.opencv.test.photo; + +import org.opencv.core.Core; +import org.opencv.core.CvType; +import org.opencv.core.Point; +import org.opencv.photo.Photo; +import org.opencv.test.OpenCVTestCase; + +public class PhotoTest extends OpenCVTestCase { + + public void testInpaint() { + Point p = new Point(matSize / 2, matSize / 2); + Core.circle(gray255, p, 2, colorBlack, Core.FILLED); + Core.circle(gray0, p, 2, colorWhite, Core.FILLED); + + Photo.inpaint(gray255, gray0, dst, 3, Photo.INPAINT_TELEA); + + assertMatEqual(getMat(CvType.CV_8U, 255), dst); + } + +} diff --git a/modules/java/android_test/src/org/opencv/test/video/VideoTest.java b/modules/java/android_test/src/org/opencv/test/video/VideoTest.java index 6d087ca..8e1cc80 100644 --- a/modules/java/android_test/src/org/opencv/test/video/VideoTest.java +++ b/modules/java/android_test/src/org/opencv/test/video/VideoTest.java @@ -71,25 +71,10 @@ public class VideoTest extends OpenCVTestCase { public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSize() { Size sz = new Size(3, 3); - Video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err, sz); + Video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err, sz, 3); assertEquals(0, Core.countNonZero(Converters.vector_uchar_to_Mat(status))); } - public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeInt() { - fail("Not yet implemented"); - } - - 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"); diff --git a/modules/java/gen_java.py b/modules/java/gen_java.py index eee82d4..ffd1ce9 100644 --- a/modules/java/gen_java.py +++ b/modules/java/gen_java.py @@ -463,6 +463,8 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize """, }, # getTextSize +## "checkRange" : #TBD +## {'j_code' : '/* TBD: checkRange() */', 'jn_code' : '', 'cpp_code' : '' }, "checkHardwareSupport" : {'j_code' : '', 'jn_code' : '', 'cpp_code' : '' }, "setUseOptimized" : {'j_code' : '', 'jn_code' : '', 'cpp_code' : '' }, @@ -514,7 +516,9 @@ func_arg_fix = { 'getAffineTransform' : { 'src' : 'vector_Point2f', 'dst' : 'vector_Point2f', }, 'hconcat' : { 'src' : 'vector_Mat', }, 'vconcat' : { 'src' : 'vector_Mat', }, - 'undistortPoints' : { 'src' : 'vector_Point2d', 'dst' : 'vector_Point2d' } + 'undistortPoints' : { 'src' : 'vector_Point2d', 'dst' : 'vector_Point2d' }, + 'checkRange' : {'pos' : '*'}, + #'meanStdDev' : {'mean' : 'Scalar', 'stddev' : 'Scalar'}, }, # '', i.e. no class } # func_arg_fix @@ -913,7 +917,7 @@ extern "C" { else: decl_args = [] for a in fi.args: - s = a.ctype + s = a.ctype or ' _hidden_ ' if a.pointer: s += "*" elif a.out: @@ -974,6 +978,8 @@ extern "C" { jni_args.append( ArgInfo([ "__int64", "self", "", [], "" ]) ) self.get_imports(fi.classname, fi.ctype) for a in args: + if not a.ctype: # hidden + continue self.get_imports(fi.classname, a.ctype) if "vector" in a.ctype: # pass as Mat jn_args.append ( ArgInfo([ "__int64", "%s_mat.nativeObj" % a.name, "", [], "" ]) ) @@ -1083,6 +1089,8 @@ extern "C" { j_args = [] for a in args: + if not a.ctype: #hidden + continue jt = type_dict[a.ctype]["j_type"] if a.out and a.ctype in ('bool', 'int', 'long', 'float', 'double'): jt += '[]' @@ -1169,11 +1177,13 @@ extern "C" { jni_name = "&%(n)s" else: jni_name = "%(n)s" + if not a.ctype: # hidden + jni_name = a.defval cvargs.append( type_dict[a.ctype].get("jni_name", jni_name) % {"n" : a.name}) if "vector" not in a.ctype : if ("I" in a.out or not a.out or a.ctype in self.classes) and "jni_var" in type_dict[a.ctype]: # complex type c_prologue.append(type_dict[a.ctype]["jni_var"] % {"n" : a.name} + ";") - if a.out and "I" not in a.out and a.ctype not in self.classes: + if a.out and "I" not in a.out and a.ctype not in self.classes and a.ctype: c_prologue.append("%s %s;" % (a.ctype, a.name)) rtype = type_dict[fi.ctype].get("jni_type", "jdoubleArray") @@ -1217,16 +1227,19 @@ JNIEXPORT $rtype JNICALL Java_org_opencv_${module}_${clazz}_$fname epilogue = " ".join(c_epilogue), \ ret = ret, \ cvname = cvname, \ - cvargs = ", ".join([a for a in cvargs]), \ + cvargs = ", ".join(cvargs), \ default = default, \ retval = retval, \ ) ) # processing args with default values - if args and args[-1].defval: - a = args.pop() - else: + if not args or not args[-1].defval: break + while args and args[-1].defval: + # 'smart' overloads filtering + a = args.pop() + if a.name in ('mask', 'dtype', 'ddepth', 'lineType', 'borderType', 'borderMode', 'criteria'): + break diff --git a/modules/java/gen_javadoc.py b/modules/java/gen_javadoc.py index 215495f..330dd7a 100644 --- a/modules/java/gen_javadoc.py +++ b/modules/java/gen_javadoc.py @@ -1,5 +1,5 @@ import os, sys, re, string, glob -allmodules = ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "gpu", "androidcamera", "haartraining", "java", "python", "stitching", "traincascade", "ts"] +allmodules = ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "gpu", "androidcamera", "haartraining", "java", "python", "stitching", "traincascade", "ts", "photo"] verbose = False show_warnings = True show_errors = True diff --git a/modules/java/rst_parser.py b/modules/java/rst_parser.py index 4e519af..a060752 100644 --- a/modules/java/rst_parser.py +++ b/modules/java/rst_parser.py @@ -1,5 +1,5 @@ import os, sys, re, string, glob -allmodules = ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "gpu", "androidcamera", "haartraining", "java", "python", "stitching", "traincascade", "ts"] +allmodules = ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "gpu", "androidcamera", "haartraining", "java", "python", "stitching", "traincascade", "ts", "photo"] verbose = False show_warnings = True show_errors = True