Commit 754a8c1b authored by Andrey Kamaev's avatar Andrey Kamaev

Java API: added more tests

parent 6b888ada
......@@ -7,6 +7,7 @@ import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.core.Core;
import org.opencv.features2d.KeyPoint;
import org.opencv.highgui.Highgui;
public class OpenCVTestCase extends TestCase {
......@@ -170,6 +171,15 @@ public class OpenCVTestCase extends TestCase {
public static void assertMatNotEqual(Mat expected, Mat actual, double eps){
compareMats(expected, actual, eps, false);
}
public static void assertKeyPointEqual(KeyPoint expected, KeyPoint actual, double eps){
assertTrue(Math.hypot(expected.pt.x - actual.pt.x, expected.pt.y - actual.pt.y) < eps);
assertTrue(Math.abs(expected.size - actual.size) < eps);
assertTrue(Math.abs(expected.angle - actual.angle) < eps);
assertTrue(Math.abs(expected.response - actual.response) < eps);
assertEquals(expected.octave, actual.octave);
assertEquals(expected.class_id, actual.class_id);
}
static private void compareMats(Mat expected, Mat actual, boolean isEqualityMeasured) {
if (expected.type() != actual.type() || expected.cols() != actual.cols()
......
......@@ -800,6 +800,19 @@ public class imgprocTest extends OpenCVTestCase {
assertMatEqual(mask.submat(1, matSize+1, 1, matSize+1), img);
}
public void testFloodFillMatMatPointScalar_WithoutMask() {
Mat img = gray0;
Core.circle(img, new Point(matSize / 2, matSize / 2), 3, new Scalar(2));
//TODO: ideally we should pass null instead of "new Mat()"
int retval = Imgproc.floodFill(img, new Mat(), new Point(matSize / 2, matSize / 2), new Scalar(1));
Core.circle(img, new Point(matSize / 2, matSize / 2), 3, new Scalar(0));
assertEquals(Core.countNonZero(img), retval);
}
public void testFloodFillMatMatPointScalarRect() {
fail("Not yet implemented");
......
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