improving Imgproc.convexityDefects() and Imgproc.convexHull()
authorAndrey Pavlenko <no@email>
Thu, 19 Apr 2012 15:27:13 +0000 (15:27 +0000)
committerAndrey Pavlenko <no@email>
Thu, 19 Apr 2012 15:27:13 +0000 (15:27 +0000)
modules/java/android_test/src/org/opencv/test/imgproc/ImgprocTest.java
modules/java/gen_java.py

index c391310..4bb92af 100644 (file)
@@ -391,16 +391,15 @@ public class ImgprocTest extends OpenCVTestCase {
                new Point(20, 10),
                new Point(30, 10)
        );
+       
+       MatOfInt hull = new MatOfInt();
 
-        Imgproc.convexHull(points, dst);
+        Imgproc.convexHull(points, hull);
 
-        MatOfPoint expHull = new MatOfPoint(
-                       new Point(40, 0),
-                       new Point(30, 20),
-                       new Point(0,  20),
-                       new Point(20, 0)
+        MatOfInt expHull = new MatOfInt(
+                       1, 2, 3, 0
         );
-        assertMatEqual(expHull, dst, EPS);
+        assertMatEqual(expHull, hull, EPS);
     }
 
     public void testConvexHullMatMatBooleanBoolean() {
@@ -413,17 +412,14 @@ public class ImgprocTest extends OpenCVTestCase {
                        new Point(3, 1)
                );
         
+       MatOfInt hull = new MatOfInt();
 
-        Imgproc.convexHull(points, dst, true, true);
-        // TODO_: write better test (last param == false)
+        Imgproc.convexHull(points, hull, true);
 
-        MatOfPoint expHull = new MatOfPoint(
-                       new Point(0, 2),
-                       new Point(3, 2),
-                       new Point(4, 0),
-                       new Point(2, 0)
+        MatOfInt expHull = new MatOfInt(
+                       3, 2, 1, 0
         );
-        assertMatEqual(expHull, dst, EPS);
+        assertMatEqual(expHull, hull, EPS);
     }
     
     public void testConvexityDefects() {
@@ -436,8 +432,8 @@ public class ImgprocTest extends OpenCVTestCase {
                new Point(30, 10)
        );
 
-        MatOfPoint hull = new MatOfPoint();
-        Imgproc.convexHull(points, hull, false, false);
+        MatOfInt hull = new MatOfInt();
+        Imgproc.convexHull(points, hull);
         
         MatOfInt4 convexityDefects = new MatOfInt4();
         Imgproc.convexityDefects(points, hull, convexityDefects);
index 3a4fcf9..ff1aed1 100644 (file)
@@ -530,9 +530,9 @@ func_arg_fix = {
         'meanStdDev' : {'mean' : 'vector_double', 'stddev' : 'vector_double'},\r
         'drawContours' : {'contours' : 'vector_vector_Point'},\r
         'findContours' : {'contours' : 'vector_vector_Point'},\r
-        'convexityDefects' : {'contour' : 'vector_Point', 'convexityDefects' : 'vector_Vec4i'},\r
+        'convexityDefects' : {'contour' : 'vector_Point', 'convexhull' : 'vector_int', 'convexityDefects' : 'vector_Vec4i'},\r
         'isContourConvex' : { 'contour' : 'vector_Point', },\r
-        'convexHull' : {'points' : 'vector_Point'},\r
+        'convexHull' : {'points' : 'vector_Point', 'hull' : 'vector_int', 'returnPoints' : ''},\r
         'projectPoints' : { 'objectPoints' : 'vector_Point3f', 'imagePoints' : 'vector_Point2f',\r
                             'distCoeffs' : 'vector_double' },\r
         'initCameraMatrix2D' : {'objectPoints' : 'vector_vector_Point3f', 'imagePoints' : 'vector_vector_Point2f', },\r