From bb33f8dd3cd44c89bdd0c183d50559b12cf76118 Mon Sep 17 00:00:00 2001 From: Andrey Pavlenko Date: Thu, 26 Jan 2012 08:51:16 +0000 Subject: [PATCH] fixing Java test compilation after API change (distanceTransform() -> distanceTransformWithLabels()) --- .../src/org/opencv/test/imgproc/ImgprocTest.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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 f0dd61b..e503adf 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 @@ -608,11 +608,11 @@ public class ImgprocTest extends OpenCVTestCase { fail("Not yet implemented"); } - public void testDistanceTransform() { + public void testDistanceTransformWithLabels() { Mat dstLables = getMat(CvType.CV_32SC1, 0); Mat labels = new Mat(); - Imgproc.distanceTransform(gray128, dst, labels, Imgproc.CV_DIST_L2, 3); + Imgproc.distanceTransformWithLabels(gray128, dst, labels, Imgproc.CV_DIST_L2, 3); assertMatEqual(dstLables, labels); assertMatEqual(getMat(CvType.CV_32FC1, 8192), dst, EPS); @@ -807,15 +807,22 @@ public class ImgprocTest extends OpenCVTestCase { Mat img2 = img.submat(5, 50, 3, 50); List contours = new ArrayList(); 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(30, 35), new Point(40, 45), new Scalar(200)); - Imgproc.findContours(img, contours, new Mat(), Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE); - Imgproc.findContours(img2, contours2, new Mat(), Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE, new Point(3, 5)); + Imgproc.findContours(img, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE); + Imgproc.findContours(img2, contours2, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE, new Point(3, 5)); assertEquals(contours.size(), contours2.size()); assertMatEqual(contours.get(0), contours2.get(0)); + /* + Log.d("findContours", "hierarchy=" + hierarchy); + int iBuff[] = new int[ (int) (hierarchy.total() * hierarchy.channels()) ]; // [ Contour0 (next sibling num, previous sibling num, 1st child num, parent num), Contour1(...), ... + hierarchy.get(0, 0, iBuff); + Log.d("findContours", Arrays.toString(iBuff)); + */ } public void testFitEllipse() { -- 2.7.4