mirror of
https://github.com/opencv/opencv.git
synced 2024-11-29 05:29:54 +08:00
Java API: tests for polylines() and goodFeaturesToTrack(), fix of GFTT corners arg type
This commit is contained in:
parent
418bc6dbe9
commit
b99c5db124
@ -1243,15 +1243,55 @@ public class coreTest extends OpenCVTestCase {
|
||||
}
|
||||
|
||||
public void testPolylinesMatListOfMatBooleanScalar() {
|
||||
fail("Not yet implemented");
|
||||
Mat img = gray0;
|
||||
List<Point> pts = new ArrayList<Point>();
|
||||
pts.add(new Point(1, 1));
|
||||
pts.add(new Point(7, 1));
|
||||
pts.add(new Point(7, 6));
|
||||
pts.add(new Point(1, 6));
|
||||
List<Mat> mats = new ArrayList<Mat>();
|
||||
mats.add( Converters.vector_Point_to_Mat(pts) );
|
||||
|
||||
assertEquals(0, Core.countNonZero(img));
|
||||
Core.polylines(img, mats, true, new Scalar(100));
|
||||
assertEquals(22, Core.countNonZero(img));
|
||||
Core.polylines(img, mats, false, new Scalar(0));
|
||||
assertEquals(4, Core.countNonZero(img));
|
||||
}
|
||||
|
||||
public void testPolylinesMatListOfMatBooleanScalarInt() {
|
||||
fail("Not yet implemented");
|
||||
Mat img = gray0;
|
||||
List<Point> pts = new ArrayList<Point>();
|
||||
pts.add(new Point(1, 1));
|
||||
pts.add(new Point(7, 1));
|
||||
pts.add(new Point(7, 6));
|
||||
pts.add(new Point(1, 6));
|
||||
List<Mat> mats = new ArrayList<Mat>();
|
||||
mats.add( Converters.vector_Point_to_Mat(pts) );
|
||||
|
||||
assertEquals(0, Core.countNonZero(img));
|
||||
Core.polylines(img, mats, true, new Scalar(100), 2);
|
||||
assertEquals(62, Core.countNonZero(img));
|
||||
}
|
||||
|
||||
public void testPolylinesMatListOfMatBooleanScalarIntInt() {
|
||||
fail("Not yet implemented");
|
||||
Mat img = gray0;
|
||||
List<Point> pts = new ArrayList<Point>();
|
||||
List<Point> pts2 = new ArrayList<Point>();
|
||||
pts.add(new Point(1, 1)); pts2.add(new Point(2, 2));
|
||||
pts.add(new Point(7, 1)); pts2.add(new Point(14, 2));
|
||||
pts.add(new Point(7, 6)); pts2.add(new Point(14, 12));
|
||||
pts.add(new Point(1, 6)); pts2.add(new Point(2, 12));
|
||||
List<Mat> mats = new ArrayList<Mat>();
|
||||
List<Mat> mats2 = new ArrayList<Mat>();
|
||||
mats.add( Converters.vector_Point_to_Mat(pts) );
|
||||
mats2.add( Converters.vector_Point_to_Mat(pts2) );
|
||||
|
||||
assertTrue(0 == Core.countNonZero(img));
|
||||
Core.polylines(img, mats, true, new Scalar(100), 2, 8, 0);
|
||||
assertFalse(0 == Core.countNonZero(img));
|
||||
Core.polylines(img, mats2, true, new Scalar(0), 2, 8, 1);
|
||||
assertTrue(0 == Core.countNonZero(img));
|
||||
}
|
||||
|
||||
public void testPolylinesMatListOfMatBooleanScalarIntIntInt() {
|
||||
|
@ -14,6 +14,7 @@ import org.opencv.core.Size;
|
||||
import org.opencv.imgproc.Imgproc;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
|
||||
public class imgprocTest extends OpenCVTestCase {
|
||||
|
||||
private Mat gray_64f_2;
|
||||
@ -1000,29 +1001,58 @@ public class imgprocTest extends OpenCVTestCase {
|
||||
}
|
||||
|
||||
public void testGoodFeaturesToTrackMatMatIntDoubleDouble() {
|
||||
Mat src = new Mat(matSize, matSize, CvType.CV_32FC1, new Scalar(2.0));
|
||||
Mat corners = new Mat(1, 4, CvType.CV_32FC2);
|
||||
corners.put(0, 0, 1.0, 1.0, 6.0, 1.0, 6.0, 1.0, 6.0, 6.0);
|
||||
Mat src = gray0;
|
||||
Core.rectangle(src, new Point(2, 2), new Point(8, 8), new Scalar(100), -1);
|
||||
List<Point> lp = new ArrayList<Point>();
|
||||
|
||||
Imgproc.goodFeaturesToTrack(src, dst, 100, 0.01, 5.0);
|
||||
// TODO : How do we test this?
|
||||
fail("Not yet implemented");
|
||||
Imgproc.goodFeaturesToTrack(src, lp, 100, 0.01, 3);
|
||||
|
||||
assertEquals(4, lp.size());
|
||||
}
|
||||
|
||||
public void testGoodFeaturesToTrackMatMatIntDoubleDoubleMat() {
|
||||
fail("Not yet implemented");
|
||||
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<Point> lp = new ArrayList<Point>();
|
||||
|
||||
Imgproc.goodFeaturesToTrack(src, lp, 100, 0.01, 3, mask);
|
||||
|
||||
assertEquals(1, lp.size());
|
||||
}
|
||||
|
||||
public void testGoodFeaturesToTrackMatMatIntDoubleDoubleMatInt() {
|
||||
fail("Not yet implemented");
|
||||
Mat src = gray0;
|
||||
Core.rectangle(src, new Point(2, 2), new Point(8, 8), new Scalar(100), -1);
|
||||
List<Point> lp = new ArrayList<Point>();
|
||||
|
||||
Imgproc.goodFeaturesToTrack(src, lp, 100, 0.01, 3, gray1, 4);
|
||||
|
||||
assertEquals(4, lp.size());
|
||||
}
|
||||
|
||||
public void testGoodFeaturesToTrackMatMatIntDoubleDoubleMatIntBoolean() {
|
||||
fail("Not yet implemented");
|
||||
Mat src = gray0;
|
||||
Core.rectangle(src, new Point(2, 2), new Point(8, 8), new Scalar(100), -1);
|
||||
List<Point> lp = new ArrayList<Point>();
|
||||
|
||||
Imgproc.goodFeaturesToTrack(src, lp, 100, 0.01, 3, gray1, 4, true);
|
||||
|
||||
assertEquals(4, lp.size());
|
||||
}
|
||||
|
||||
public void testGoodFeaturesToTrackMatMatIntDoubleDoubleMatIntBooleanDouble() {
|
||||
fail("Not yet implemented");
|
||||
Mat src = gray0;
|
||||
Core.rectangle(src, new Point(2, 2), new Point(8, 8), new Scalar(100), -1);
|
||||
List<Point> lp = new ArrayList<Point>();
|
||||
|
||||
Imgproc.goodFeaturesToTrack(src, lp, 100, 0.01, 3, gray1, 4, true, 0);
|
||||
|
||||
assertEquals(4, lp.size());
|
||||
}
|
||||
|
||||
public void testGrabCutMatMatRectMatMatInt() {
|
||||
|
@ -457,6 +457,7 @@ func_arg_fix = {
|
||||
'randu' : { 'low' : 'Scalar', 'high' : 'Scalar', },
|
||||
'randn' : { 'mean' : 'Scalar', 'stddev' : 'Scalar', },
|
||||
'inRange' : { 'lowerb' : 'Scalar', 'upperb' : 'Scalar', },
|
||||
'goodFeaturesToTrack' : { 'corners' : 'vector_Point' },
|
||||
}, # '', i.e. empty class
|
||||
} # func_arg_fix
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user