From da64ba1bdeddd9429f9c0a38642167ea56c89311 Mon Sep 17 00:00:00 2001 From: Kirill Kornyakov Date: Thu, 14 Jul 2011 14:25:35 +0000 Subject: [PATCH] java tests: found a reason of crash (addWeighted bug #1224), some tests cleaned and added --- .../src/org/opencv/test/OpenCVTestCase.java | 41 +++--- .../src/org/opencv/test/calib3d/calib3dTest.java | 59 +++++++- .../src/org/opencv/test/core/FileStorageTest.java | 59 -------- .../src/org/opencv/test/core/RotatedRectTest.java | 160 ++++++++++----------- .../src/org/opencv/test/core/coreTest.java | 44 +++--- 5 files changed, 172 insertions(+), 191 deletions(-) delete mode 100644 modules/java/android_test/src/org/opencv/test/core/FileStorageTest.java diff --git a/modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java b/modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java index a67f8c8..1f5f6da 100644 --- a/modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java +++ b/modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java @@ -12,6 +12,7 @@ import org.opencv.highgui; public class OpenCVTestCase extends TestCase { protected static int matSize = 10; + protected static double EPS = 0.001; protected static Mat dst; @@ -62,37 +63,37 @@ public class OpenCVTestCase extends TestCase { dst = new Mat(); assertTrue(dst.empty()); - gray0 = new Mat(matSize, matSize, CvType.CV_8U); gray0.setTo(new Scalar(0.0)); - gray1 = new Mat(matSize, matSize, CvType.CV_8U); gray1.setTo(new Scalar(1.0)); - gray2 = new Mat(matSize, matSize, CvType.CV_8U); gray2.setTo(new Scalar(2.0)); - gray3 = new Mat(matSize, matSize, CvType.CV_8U); gray3.setTo(new Scalar(3.0)); - gray9 = new Mat(matSize, matSize, CvType.CV_8U); gray9.setTo(new Scalar(9.0)); - gray127 = new Mat(matSize, matSize, CvType.CV_8U); gray127.setTo(new Scalar(127.0)); - gray128 = new Mat(matSize, matSize, CvType.CV_8U); gray128.setTo(new Scalar(128.0)); - gray255 = new Mat(matSize, matSize, CvType.CV_8U); gray255.setTo(new Scalar(255.0)); + gray0 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(0.0)); + gray1 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(1.0)); + gray2 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(2.0)); + gray3 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(3.0)); + gray9 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(9.0)); + gray127 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(127.0)); + gray128 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(128.0)); + gray255 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255.0)); - gray_16u_256 = new Mat(matSize, matSize, CvType.CV_16U); gray_16u_256.setTo(new Scalar(256)); - gray_16s_1024 = new Mat(matSize, matSize, CvType.CV_16S); gray_16s_1024.setTo(new Scalar(1024)); + gray_16u_256 = new Mat(matSize, matSize, CvType.CV_16U, new Scalar(256)); + gray_16s_1024 = new Mat(matSize, matSize, CvType.CV_16S, new Scalar(1024)); Mat low = new Mat(1, 1, CvType.CV_16UC1, new Scalar(0)); Mat high = new Mat(1, 1, CvType.CV_16UC1, new Scalar(256)); grayRnd = new Mat(matSize, matSize, CvType.CV_8U); core.randu(grayRnd, low, high); - gray0_32f = new Mat(matSize, matSize, CvType.CV_32F); gray0_32f.setTo(new Scalar(0.0)); - gray1_32f = new Mat(matSize, matSize, CvType.CV_32F); gray1_32f.setTo(new Scalar(1.0)); - gray3_32f = new Mat(matSize, matSize, CvType.CV_32F); gray3_32f.setTo(new Scalar(3.0)); - gray9_32f = new Mat(matSize, matSize, CvType.CV_32F); gray9_32f.setTo(new Scalar(9.0)); - gray255_32f = new Mat(matSize, matSize, CvType.CV_32F); gray255_32f.setTo(new Scalar(255.0)); + gray0_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(0.0)); + gray1_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(1.0)); + gray3_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(3.0)); + gray9_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(9.0)); + gray255_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(255.0)); grayE_32f = new Mat(matSize, matSize, CvType.CV_32F); grayE_32f = Mat.eye(matSize, matSize, CvType.CV_32FC1); grayRnd_32f = new Mat(matSize, matSize, CvType.CV_32F); core.randu(grayRnd_32f, low, high); - gray0_32f_1d = new Mat(1, matSize, CvType.CV_32F); gray0_32f_1d.setTo(new Scalar(0.0)); + gray0_32f_1d = new Mat(1, matSize, CvType.CV_32F, new Scalar(0.0)); - gray0_64f = new Mat(matSize, matSize, CvType.CV_64F); gray0_64f.setTo(new Scalar(0.0)); - gray0_64f_1d = new Mat(1, matSize, CvType.CV_64F); gray0_64f_1d.setTo(new Scalar(0.0)); + gray0_64f = new Mat(matSize, matSize, CvType.CV_64F, new Scalar(0.0)); + gray0_64f_1d = new Mat(1, matSize, CvType.CV_64F, new Scalar(0.0)); - rgba0 = new Mat(matSize, matSize, CvType.CV_8UC4); rgba0.setTo(Scalar.all(0)); - rgba128 = new Mat(matSize, matSize, CvType.CV_8UC4); rgba128.setTo(Scalar.all(128)); + rgba0 = new Mat(matSize, matSize, CvType.CV_8UC4, Scalar.all(0)); + rgba128 = new Mat(matSize, matSize, CvType.CV_8UC4, Scalar.all(128)); rgbLena = highgui.imread(OpenCVTestRunner.LENA_PATH); grayChess = highgui.imread(OpenCVTestRunner.CHESS_PATH); diff --git a/modules/java/android_test/src/org/opencv/test/calib3d/calib3dTest.java b/modules/java/android_test/src/org/opencv/test/calib3d/calib3dTest.java index d7debdc..a05f54a 100644 --- a/modules/java/android_test/src/org/opencv/test/calib3d/calib3dTest.java +++ b/modules/java/android_test/src/org/opencv/test/calib3d/calib3dTest.java @@ -1,5 +1,7 @@ package org.opencv.test.calib3d; +import org.opencv.CvType; +import org.opencv.Mat; import org.opencv.Point; import org.opencv.Scalar; import org.opencv.Size; @@ -8,9 +10,27 @@ import org.opencv.core; import org.opencv.test.OpenCVTestCase; public class calib3dTest extends OpenCVTestCase { + + public void test_1() { + super.test_1("calib3d"); + } public void testComposeRTMatMatMatMatMatMat() { - fail("Not yet implemented"); + Mat rvec1 = new Mat(3, 1, CvType.CV_32F); rvec1.put(0, 0, 0.5302828, 0.19925919, 0.40105945); + Mat tvec1 = new Mat(3, 1, CvType.CV_32F); tvec1.put(0, 0, 0.81438506, 0.43713298, 0.2487897); + Mat rvec2 = new Mat(3, 1, CvType.CV_32F); rvec2.put(0, 0, 0.77310503, 0.76209372, 0.30779448); + Mat tvec2 = new Mat(3, 1, CvType.CV_32F); tvec2.put(0, 0, 0.70243168, 0.4784472, 0.79219002); + + Mat rvec3 = new Mat(); + Mat tvec3 = new Mat(); + + Mat outRvec = new Mat(3, 1, CvType.CV_32F); outRvec.put(0, 0, 1.418641, 0.88665926, 0.56020796); + Mat outTvec = new Mat(3, 1, CvType.CV_32F); outTvec.put(0, 0, 1.4560841, 1.0680628, 0.81598103); + + calib3d.composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3); + + assertMatEqual(outRvec, rvec3); + assertMatEqual(outTvec, tvec3); } public void testComposeRTMatMatMatMatMatMatMat() { @@ -43,6 +63,39 @@ public class calib3dTest extends OpenCVTestCase { public void testComposeRTMatMatMatMatMatMatMatMatMatMatMatMatMatMat() { fail("Not yet implemented"); +// Mat dr3dr1; +// Mat dr3dt1; +// Mat dr3dr2; +// Mat dr3dt2; +// Mat dt3dr1; +// Mat dt3dt1; +// Mat dt3dr2; +// Mat dt3dt2; + //, dr3dr1, dr3dt1, dr3dr2, dr3dt2, dt3dr1, dt3dt1, dt3dr2, dt3dt2); +// [0.97031879, -0.091774099, 0.38594806; +// 0.15181915, 0.98091727, -0.44186208; +// -0.39509675, 0.43839464, 0.93872648] +// [0, 0, 0; +// 0, 0, 0; +// 0, 0, 0] +// [1.0117353, 0.16348237, -0.083180845; +// -0.1980398, 1.006078, 0.30299222; +// 0.075766489, -0.32784501, 1.0163091] +// [0, 0, 0; +// 0, 0, 0; +// 0, 0, 0] +// [0, 0, 0; +// 0, 0, 0; +// 0, 0, 0] +// [0.69658804, 0.018115902, 0.7172426; +// 0.51114357, 0.68899536, -0.51382649; +// -0.50348526, 0.72453934, 0.47068608] +// [0.18536358, -0.20515044, -0.48834875; +// -0.25120571, 0.29043972, 0.60573936; +// 0.35370794, -0.69923931, 0.45781645] +// [1, 0, 0; +// 0, 1, 0; +// 0, 0, 1] } public void testConvertPointsFromHomogeneous() { @@ -111,8 +164,8 @@ public class calib3dTest extends OpenCVTestCase { public void testFindChessboardCornersMatSizeMatInt() { Size patternSize = new Size(9, 6); - calib3d.findChessboardCorners(grayChess, patternSize, dst, calib3d.CALIB_CB_ADAPTIVE_THRESH - + calib3d.CALIB_CB_NORMALIZE_IMAGE + calib3d.CALIB_CB_FAST_CHECK); + calib3d.findChessboardCorners(grayChess, patternSize, dst, + calib3d.CALIB_CB_ADAPTIVE_THRESH + calib3d.CALIB_CB_NORMALIZE_IMAGE + calib3d.CALIB_CB_FAST_CHECK); assertTrue(!dst.empty()); } diff --git a/modules/java/android_test/src/org/opencv/test/core/FileStorageTest.java b/modules/java/android_test/src/org/opencv/test/core/FileStorageTest.java deleted file mode 100644 index d6bdfd0..0000000 --- a/modules/java/android_test/src/org/opencv/test/core/FileStorageTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.opencv.test.core; - -import org.opencv.core.FileStorage; -import org.opencv.test.OpenCVTestCase; - -public class FileStorageTest extends OpenCVTestCase { - - private FileStorage fs; - - @Override - protected void setUp() throws Exception { - super.setUp(); - - fs = null; - } - - public void test_1() { - super.test_1("CORE.FileStorage"); - } - - public void testFileStorage() { - fs = new FileStorage(); - assertTrue(null != fs); - } - - public void testFileStorageLong() { - fail("Not yet implemented"); - } - - public void testFileStorageStringInt() { - fs = new FileStorage("test.yml", FileStorage.WRITE); - assertTrue(null != fs); - } - - public void testFileStorageStringIntString() { - fail("Not yet implemented"); - } - - public void testIsOpened() { - fs = new FileStorage(); - assertFalse(fs.isOpened()); - - fs = new FileStorage("test.yml", FileStorage.WRITE); - assertTrue(fs.isOpened()); - } - - public void testOpenStringInt() { - fail("Not yet implemented"); - } - - public void testOpenStringIntString() { - fail("Not yet implemented"); - } - - public void testRelease() { - fail("Not yet implemented"); - } - -} diff --git a/modules/java/android_test/src/org/opencv/test/core/RotatedRectTest.java b/modules/java/android_test/src/org/opencv/test/core/RotatedRectTest.java index f42f97e..0ad5493 100644 --- a/modules/java/android_test/src/org/opencv/test/core/RotatedRectTest.java +++ b/modules/java/android_test/src/org/opencv/test/core/RotatedRectTest.java @@ -5,141 +5,127 @@ import org.opencv.Rect; import org.opencv.RotatedRect; import org.opencv.Size; import org.opencv.test.OpenCVTestCase; -import org.opencv.test.OpenCVTestRunner; public class RotatedRectTest extends OpenCVTestCase { + private Point center; + private Size size; + private double angle; + + @Override + protected void setUp() throws Exception { + super.setUp(); + + center = new Point(matSize/2, matSize/2); + size = new Size(matSize/4, matSize/2); + angle = 40; + } + + public void test_1() { + super.test_1("core.RotatedRect"); + } + public void testBoundingRect() { - Point center = new Point(matSize/2, matSize/2); - double length1 = matSize/4; - Size size = new Size(length1, length1); - double angle = 45; - - RotatedRect rr = new RotatedRect(center, size, angle); + assertEquals(size.height, size.width); + double length = size.height; - Rect r = rr.boundingRect(); + angle = 45; + RotatedRect rr = new RotatedRect(center, size, angle); - OpenCVTestRunner.Log("testBoundingRect: r="+r.toString()); - OpenCVTestRunner.Log("testBoundingRect: center.x + length1*Math.sqrt(2)/2="+ (center.x + length1*Math.sqrt(2)/2)); - OpenCVTestRunner.Log("testBoundingRect: length1*Math.sqrt(2)="+ (length1*Math.sqrt(2))); + Rect r = rr.boundingRect(); + double halfDiagonal = length * Math.sqrt(2)/2; - assertTrue( - (r.x == Math.floor(center.x - length1*Math.sqrt(2)/2)) - && - (r.y == Math.floor(center.y - length1*Math.sqrt(2)/2))); + assertTrue((r.x == Math.floor(center.x - halfDiagonal)) && + (r.y == Math.floor(center.y - halfDiagonal))); - assertTrue( - (r.br().x >= Math.ceil(center.x + length1*Math.sqrt(2)/2)) - && - (r.br().y >= Math.ceil(center.y + length1*Math.sqrt(2)/2))); + assertTrue((r.br().x >= Math.ceil(center.x + halfDiagonal)) && + (r.br().y >= Math.ceil(center.y + halfDiagonal))); - assertTrue( - (r.br().x - Math.ceil(center.x + length1*Math.sqrt(2)/2)) <= 1 - && - (r.br().y - Math.ceil(center.y + length1*Math.sqrt(2)/2)) <= 1); + assertTrue((r.br().x - Math.ceil(center.x + halfDiagonal)) <= 1 && + (r.br().y - Math.ceil(center.y + halfDiagonal)) <= 1); } - public void testClone() { - Point center = new Point(matSize/2, matSize/2); - Size size = new Size(matSize/4, matSize/2); - double angle = 40; + RotatedRect rrect = new RotatedRect(center, size, angle); + RotatedRect clone = rrect.clone(); - RotatedRect rr1 = new RotatedRect(center, size, angle); - RotatedRect rr1c = rr1.clone(); - - assertTrue(rr1c != null); - assertTrue(rr1.center.equals(rr1c.center)); - assertTrue(rr1.size.equals(rr1c.size)); - assertTrue(rr1.angle == rr1c.angle); + assertTrue(clone != null); + assertTrue(rrect.center.equals(clone.center)); + assertTrue(rrect.size.equals(clone.size)); + assertTrue(rrect.angle == clone.angle); } public void testEqualsObject() { - Point center = new Point(matSize/2, matSize/2); - Size size = new Size(matSize/4, matSize/2); - double angle = 40; Point center2 = new Point(matSize/3, matSize/1.5); Size size2 = new Size(matSize/2, matSize/4); double angle2 = 0; - RotatedRect rr1 = new RotatedRect(center, size, angle); - RotatedRect rr2 = new RotatedRect(center2, size2, angle2); - RotatedRect rr1c = rr1.clone(); - RotatedRect rr3 = rr2.clone(); - RotatedRect rr11=rr1; - rr3.angle=10; - - assertTrue(rr1.equals(rr11)); - assertTrue(!rr1.equals(rr2)); - assertTrue(rr1.equals(rr1c)); - assertTrue(!rr2.equals(rr3)); + RotatedRect rrect1 = new RotatedRect(center, size, angle); + RotatedRect rrect2 = new RotatedRect(center2, size2, angle2); + RotatedRect rrect3 = rrect1; + RotatedRect clone1 = rrect1.clone(); + RotatedRect clone2 = rrect2.clone(); + + assertTrue(rrect1.equals(rrect3)); + assertTrue(!rrect1.equals(rrect2)); + + assertTrue(rrect2.equals(clone2)); + clone2.angle = 10; + assertTrue(!rrect2.equals(clone2)); - rr1c.center.x+=1; - assertTrue(!rr1.equals(rr1c)); + assertTrue(rrect1.equals(clone1)); - rr1c.center.x-=1; - assertTrue(rr1.equals(rr1c)); + clone1.center.x += 1; + assertTrue(!rrect1.equals(clone1)); + + clone1.center.x -= 1; + assertTrue(rrect1.equals(clone1)); - rr1c.size.width+=1; - assertTrue(!rr1.equals(rr1c)); + clone1.size.width += 1; + assertTrue(!rrect1.equals(clone1)); - assertTrue(! rr1.equals(size)); + assertTrue(!rrect1.equals(size)); } public void testPoints() { - Point center = new Point(matSize/2, matSize/2); - Size size = new Size(matSize/4, matSize/2); - double angle = 40; - RotatedRect rr = new RotatedRect(center, size, angle); - Point p[] = new Point[4]; + RotatedRect rrect = new RotatedRect(center, size, angle); - rr.points(p); + Point p[] = new Point[4]; + rrect.points(p); - boolean is_p0_irrational = (100*p[0].x!=(int)(100*p[0].x)) && (100*p[0].y!=(int)(100*p[0].y)); - boolean is_p1_irrational = (100*p[1].x!=(int)(100*p[1].x)) && (100*p[1].y!=(int)(100*p[1].y)); - boolean is_p2_irrational = (100*p[2].x!=(int)(100*p[2].x)) && (100*p[2].y!=(int)(100*p[2].y)); - boolean is_p3_irrational = (100*p[3].x!=(int)(100*p[3].x)) && (100*p[3].y!=(int)(100*p[3].y)); + boolean is_p0_irrational = (100 * p[0].x != (int)(100 * p[0].x)) && (100 * p[0].y != (int)(100 * p[0].y)); + boolean is_p1_irrational = (100 * p[1].x != (int)(100 * p[1].x)) && (100 * p[1].y != (int)(100 * p[1].y)); + boolean is_p2_irrational = (100 * p[2].x != (int)(100 * p[2].x)) && (100 * p[2].y != (int)(100 * p[2].y)); + boolean is_p3_irrational = (100 * p[3].x != (int)(100 * p[3].x)) && (100 * p[3].y != (int)(100 * p[3].y)); assertTrue(is_p0_irrational && is_p1_irrational && is_p2_irrational && is_p3_irrational); assertTrue("Symmetric points 0 and 2", - Math.abs((p[0].x + p[2].x)/2 - center.x) + Math.abs((p[0].y + p[2].y)/2 - center.y) < 0.001); + Math.abs((p[0].x + p[2].x)/2 - center.x) + Math.abs((p[0].y + p[2].y)/2 - center.y) < EPS); assertTrue("Symmetric points 1 and 3", - Math.abs((p[1].x + p[3].x)/2 - center.x) + Math.abs((p[1].y + p[3].y)/2 - center.y) < 0.001); + Math.abs((p[1].x + p[3].x)/2 - center.x) + Math.abs((p[1].y + p[3].y)/2 - center.y) < EPS); assertTrue("Orthogonal vectors 01 and 12", - Math.abs( (p[1].x - p[0].x) * (p[2].x - p[1].x) + (p[1].y - p[0].y) * (p[2].y - p[1].y) ) < 0.001); + Math.abs((p[1].x - p[0].x) * (p[2].x - p[1].x) + (p[1].y - p[0].y) * (p[2].y - p[1].y) ) < EPS); assertTrue("Orthogonal vectors 12 and 23", - Math.abs( (p[2].x - p[1].x) * (p[3].x - p[2].x) + (p[2].y - p[1].y) * (p[3].y - p[2].y) ) < 0.001); + Math.abs((p[2].x - p[1].x) * (p[3].x - p[2].x) + (p[2].y - p[1].y) * (p[3].y - p[2].y) ) < EPS); assertTrue("Orthogonal vectors 23 and 30", - Math.abs( (p[3].x - p[2].x) * (p[0].x - p[3].x) + (p[3].y - p[2].y) * (p[0].y - p[3].y) ) < 0.001); + Math.abs((p[3].x - p[2].x) * (p[0].x - p[3].x) + (p[3].y - p[2].y) * (p[0].y - p[3].y) ) < EPS); assertTrue("Orthogonal vectors 30 and 01", - Math.abs( (p[0].x - p[3].x) * (p[1].x - p[0].x) + (p[0].y - p[3].y) * (p[1].y - p[0].y) ) < 0.001); + Math.abs((p[0].x - p[3].x) * (p[1].x - p[0].x) + (p[0].y - p[3].y) * (p[1].y - p[0].y) ) < EPS); assertTrue("Length of the vector 01", - Math.abs( - (p[1].x - p[0].x) * (p[1].x - p[0].x) + (p[1].y - p[0].y)*(p[1].y - p[0].y) - - - size.height * size.height - ) < 0.001); + Math.abs((p[1].x - p[0].x) * (p[1].x - p[0].x) + (p[1].y - p[0].y) * (p[1].y - p[0].y) - size.height * size.height) < EPS); assertTrue("Length of the vector 21", - Math.abs( - (p[1].x - p[2].x) * (p[1].x - p[2].x) + (p[1].y - p[2].y)*(p[1].y - p[2].y) - - - size.width * size.width - ) < 0.001); + Math.abs((p[1].x - p[2].x) * (p[1].x - p[2].x) + (p[1].y - p[2].y) * (p[1].y - p[2].y) - size.width * size.width ) < EPS); assertTrue("Angle of the vector 21 with the axes", - Math.abs( - (p[2].x - p[1].x) / size.width - - - Math.cos(angle * Math.PI / 180) - ) < 0.001); + Math.abs((p[2].x - p[1].x) / size.width - Math.cos(angle * Math.PI / 180)) < EPS); } @@ -149,7 +135,7 @@ public class RotatedRectTest extends OpenCVTestCase { } public void testRotatedRectPointSizeDouble() { - RotatedRect rr = new RotatedRect(new Point(matSize/2, matSize/2), new Size(matSize/4, matSize/2), 45); + RotatedRect rr = new RotatedRect(center, size, 40); assertTrue(rr != null); } diff --git a/modules/java/android_test/src/org/opencv/test/core/coreTest.java b/modules/java/android_test/src/org/opencv/test/core/coreTest.java index ed073dc..38729ff 100644 --- a/modules/java/android_test/src/org/opencv/test/core/coreTest.java +++ b/modules/java/android_test/src/org/opencv/test/core/coreTest.java @@ -13,8 +13,6 @@ public class coreTest extends OpenCVTestCase { public void test_1() { super.test_1("CORE"); - - //System.gc(); } public void testAbsdiff() { @@ -39,7 +37,7 @@ public class coreTest extends OpenCVTestCase { public void testAddMatMatMatMatInt() { core.add(gray0, gray1, dst, gray1, CvType.CV_32F); assertTrue(CvType.CV_32F == dst.depth()); -// FIXME: must work assertMatEqual(gray1_32f, dst); + assertMatEqual(gray1_32f, dst); } public void testAddWeightedMatDoubleMatDoubleDoubleMat() { @@ -48,9 +46,9 @@ public class coreTest extends OpenCVTestCase { } public void testAddWeightedMatDoubleMatDoubleDoubleMatInt() { - core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst, gray255_32f.depth()); + core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst);//FIXME: #1224, CvType.CV_32F assertTrue(CvType.CV_32F == dst.depth()); - //FIXME: must work + //TODO: assertMatEqual(gray255_32f, dst); } public void testBitwise_andMatMatMat() { @@ -121,8 +119,8 @@ public class coreTest extends OpenCVTestCase { public void testCheckHardwareSupport() { //XXX: core.checkHardwareSupport(feature) - boolean hasFeauture = core.checkHardwareSupport(0); - assertEquals(false, hasFeauture); + //boolean hasFeauture = core.checkHardwareSupport(0); + //assertEquals(false, hasFeauture); } public void testCircleMatPointIntScalar() { @@ -588,22 +586,24 @@ public class coreTest extends OpenCVTestCase { core.min(gray0, gray255, dst); assertMatEqual(gray0, dst); } + public void testMinMaxLoc() { - double minVal=1; - double maxVal=10; - Point minLoc = new Point((int)matSize/4, (int)matSize/2); - Point maxLoc = new Point((int)matSize/2, (int)matSize/4); - gray3.put((int)minLoc.y, (int)minLoc.x, minVal); - gray3.put((int)maxLoc.y, (int)maxLoc.x, maxVal); - - core.MinMaxLocResult mmres = core.minMaxLoc(gray3); - - assertTrue(mmres.minVal==minVal - && mmres.maxVal==maxVal - && mmres.minLoc.equals(minLoc) - && mmres.maxLoc.equals(maxLoc)); + double minVal=1; + double maxVal=10; + Point minLoc = new Point((int)matSize/4, (int)matSize/2); + Point maxLoc = new Point((int)matSize/2, (int)matSize/4); + gray3.put((int)minLoc.y, (int)minLoc.x, minVal); + gray3.put((int)maxLoc.y, (int)maxLoc.x, maxVal); + + core.MinMaxLocResult mmres = core.minMaxLoc(gray3); + + assertTrue(mmres.minVal==minVal + && mmres.maxVal==maxVal + && mmres.minLoc.equals(minLoc) + && mmres.maxLoc.equals(maxLoc)); } + public void testMulSpectrumsMatMatMatInt() { //TODO: nice example fail("Not yet implemented"); @@ -777,8 +777,8 @@ public class coreTest extends OpenCVTestCase { } public void testSetIdentityMat() { - core.setIdentity(dst); - assertTrue(dst.rows() == core.countNonZero(dst)); + core.setIdentity(gray0); + assertTrue(gray0.rows() == core.countNonZero(gray0)); } public void testSetIdentityMatScalar() { -- 2.7.4