Commit e1ad6b27 authored by itsyplen's avatar itsyplen

several java tests added

parent afad87b5
...@@ -19,6 +19,8 @@ public class OpenCVTestCase extends AndroidTestCase { ...@@ -19,6 +19,8 @@ public class OpenCVTestCase extends AndroidTestCase {
static Mat gray128; static Mat gray128;
static Mat gray255; static Mat gray255;
static Mat gray255_32f;
static Mat grayRnd; static Mat grayRnd;
static Mat grayRnd_32f; static Mat grayRnd_32f;
...@@ -49,6 +51,8 @@ public class OpenCVTestCase extends AndroidTestCase { ...@@ -49,6 +51,8 @@ public class OpenCVTestCase extends AndroidTestCase {
gray128 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray128.setTo(128.0); gray128 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray128.setTo(128.0);
gray255 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray255.setTo(256.0); gray255 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray255.setTo(256.0);
gray255_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); gray255_32f.setTo(255.0);
Mat low = new Mat(1, 1, Mat.CvType.CV_16UC1); low.setTo(0); Mat low = new Mat(1, 1, Mat.CvType.CV_16UC1); low.setTo(0);
Mat high = new Mat(1, 1, Mat.CvType.CV_16UC1); high.setTo(256); Mat high = new Mat(1, 1, Mat.CvType.CV_16UC1); high.setTo(256);
grayRnd = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); core.randu(grayRnd, low, high); grayRnd = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); core.randu(grayRnd, low, high);
......
...@@ -63,11 +63,14 @@ public class coreTest extends OpenCVTestCase { ...@@ -63,11 +63,14 @@ public class coreTest extends OpenCVTestCase {
} }
public void testAddWeightedMatDoubleMatDoubleDoubleMatInt() { public void testAddWeightedMatDoubleMatDoubleDoubleMatInt() {
fail("Not yet implemented"); Mat dst = new Mat();
core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst, gray255_32f.depth());
assertTrue(gray255_32f.depth() == dst.depth());
} }
public void testAddWeightedMatDoubleMatDoubleDoubleMat() { public void testAddWeightedMatDoubleMatDoubleDoubleMat() {
fail("Not yet implemented"); core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst_gray);
assertMatEqual(gray255, dst_gray);
} }
public void testBitwise_andMatMatMatMat() { public void testBitwise_andMatMatMatMat() {
...@@ -164,6 +167,11 @@ public class coreTest extends OpenCVTestCase { ...@@ -164,6 +167,11 @@ public class coreTest extends OpenCVTestCase {
core.compare(gray0, gray1, cmp, core.CMP_EQ); core.compare(gray0, gray1, cmp, core.CMP_EQ);
assertMatEqual(cmp, gray0); assertMatEqual(cmp, gray0);
core.compare(gray0, grayRnd, cmp, core.CMP_EQ);
double nBlackPixels = core.countNonZero(cmp);
double nNonBlackpixels = core.countNonZero(grayRnd);
assertTrue((nBlackPixels+nNonBlackpixels) == grayRnd.rows()*grayRnd.cols());
} }
public void testCompleteSymmMatBoolean() { public void testCompleteSymmMatBoolean() {
...@@ -419,7 +427,8 @@ public class coreTest extends OpenCVTestCase { ...@@ -419,7 +427,8 @@ public class coreTest extends OpenCVTestCase {
} }
public void testMulTransposedMatMatBooleanMat() { public void testMulTransposedMatMatBooleanMat() {
fail("Not yet implemented"); core.mulTransposed(grayRnd_32f, dst_gray_32f, true, grayRnd_32f);
assertMatEqual(gray0_32f, dst_gray_32f);
} }
public void testMulTransposedMatMatBoolean() { public void testMulTransposedMatMatBoolean() {
......
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