Commit dbccc9b1 authored by Andrey Pavlenko's avatar Andrey Pavlenko

improving Imgproc.convexityDefects() and Imgproc.convexHull()

parent 2ec0efaa
...@@ -392,15 +392,14 @@ public class ImgprocTest extends OpenCVTestCase { ...@@ -392,15 +392,14 @@ public class ImgprocTest extends OpenCVTestCase {
new Point(30, 10) new Point(30, 10)
); );
Imgproc.convexHull(points, dst); MatOfInt hull = new MatOfInt();
MatOfPoint expHull = new MatOfPoint( Imgproc.convexHull(points, hull);
new Point(40, 0),
new Point(30, 20), MatOfInt expHull = new MatOfInt(
new Point(0, 20), 1, 2, 3, 0
new Point(20, 0)
); );
assertMatEqual(expHull, dst, EPS); assertMatEqual(expHull, hull, EPS);
} }
public void testConvexHullMatMatBooleanBoolean() { public void testConvexHullMatMatBooleanBoolean() {
...@@ -413,17 +412,14 @@ public class ImgprocTest extends OpenCVTestCase { ...@@ -413,17 +412,14 @@ public class ImgprocTest extends OpenCVTestCase {
new Point(3, 1) new Point(3, 1)
); );
MatOfInt hull = new MatOfInt();
Imgproc.convexHull(points, dst, true, true); Imgproc.convexHull(points, hull, true);
// TODO_: write better test (last param == false)
MatOfPoint expHull = new MatOfPoint( MatOfInt expHull = new MatOfInt(
new Point(0, 2), 3, 2, 1, 0
new Point(3, 2),
new Point(4, 0),
new Point(2, 0)
); );
assertMatEqual(expHull, dst, EPS); assertMatEqual(expHull, hull, EPS);
} }
public void testConvexityDefects() { public void testConvexityDefects() {
...@@ -436,8 +432,8 @@ public class ImgprocTest extends OpenCVTestCase { ...@@ -436,8 +432,8 @@ public class ImgprocTest extends OpenCVTestCase {
new Point(30, 10) new Point(30, 10)
); );
MatOfPoint hull = new MatOfPoint(); MatOfInt hull = new MatOfInt();
Imgproc.convexHull(points, hull, false, false); Imgproc.convexHull(points, hull);
MatOfInt4 convexityDefects = new MatOfInt4(); MatOfInt4 convexityDefects = new MatOfInt4();
Imgproc.convexityDefects(points, hull, convexityDefects); Imgproc.convexityDefects(points, hull, convexityDefects);
......
...@@ -530,9 +530,9 @@ func_arg_fix = { ...@@ -530,9 +530,9 @@ func_arg_fix = {
'meanStdDev' : {'mean' : 'vector_double', 'stddev' : 'vector_double'}, 'meanStdDev' : {'mean' : 'vector_double', 'stddev' : 'vector_double'},
'drawContours' : {'contours' : 'vector_vector_Point'}, 'drawContours' : {'contours' : 'vector_vector_Point'},
'findContours' : {'contours' : 'vector_vector_Point'}, 'findContours' : {'contours' : 'vector_vector_Point'},
'convexityDefects' : {'contour' : 'vector_Point', 'convexityDefects' : 'vector_Vec4i'}, 'convexityDefects' : {'contour' : 'vector_Point', 'convexhull' : 'vector_int', 'convexityDefects' : 'vector_Vec4i'},
'isContourConvex' : { 'contour' : 'vector_Point', }, 'isContourConvex' : { 'contour' : 'vector_Point', },
'convexHull' : {'points' : 'vector_Point'}, 'convexHull' : {'points' : 'vector_Point', 'hull' : 'vector_int', 'returnPoints' : ''},
'projectPoints' : { 'objectPoints' : 'vector_Point3f', 'imagePoints' : 'vector_Point2f', 'projectPoints' : { 'objectPoints' : 'vector_Point3f', 'imagePoints' : 'vector_Point2f',
'distCoeffs' : 'vector_double' }, 'distCoeffs' : 'vector_double' },
'initCameraMatrix2D' : {'objectPoints' : 'vector_vector_Point3f', 'imagePoints' : 'vector_vector_Point2f', }, 'initCameraMatrix2D' : {'objectPoints' : 'vector_vector_Point3f', 'imagePoints' : 'vector_vector_Point2f', },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment