diff --git a/modules/java/android_test/res/drawable/lena.jpg b/modules/java/android_test/res/drawable/lena.jpg new file mode 100644 index 0000000000..f06aa74a57 Binary files /dev/null and b/modules/java/android_test/res/drawable/lena.jpg differ 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 bd76429d8e..44efd34c73 100644 --- a/modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java +++ b/modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java @@ -4,6 +4,7 @@ import java.io.FileOutputStream; import org.opencv.Mat; import org.opencv.core; +import org.opencv.highgui; import android.content.Context; import android.graphics.Bitmap; @@ -18,6 +19,11 @@ public class OpenCVTestCase extends AndroidTestCase { static String LENA = "/data/data/org.opencv.test/files/lena.jpg"; static int matSize = 10; + + //Naming notation: channels_[type]_[dimension]_value + //examples: gray0 - single channel 8U 2d Mat filled with 0 + // grayRnd - single channel 8U 2d Mat filled with random numbers + // gray0_32f_1d - refactor ;) static Mat gray0; static Mat gray1; @@ -41,20 +47,15 @@ public class OpenCVTestCase extends AndroidTestCase { static Mat gray0_64f_1d; static Mat rgba0; - static Mat rgba128; + static Mat rgba128; + + static Mat rgbLena; - static Mat dst_gray; - static Mat dst_gray_32f; + static Mat dst; @Override protected void setUp() throws Exception { - // Log.e(TAG, "setUp"); super.setUp(); - - //Naming notation: channels_[type]_[dimension]_value - //examples: gray0 - single channel 8U 2d Mat filled with 0 - // grayRnd - single channel 8U 2d Mat filled with random numbers - // gray0_32f_1d - refactor ;) gray0 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray0.setTo(0.0); gray1 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray1.setTo(1.0); @@ -92,11 +93,11 @@ public class OpenCVTestCase extends AndroidTestCase { catch (Exception e) { Log.e(TAG, "Tried to write lena.jpg, but: " + e.toString()); } + + rgbLena = highgui.imread(LENA); - dst_gray = new Mat(); - assertTrue(dst_gray.empty()); - dst_gray_32f = new Mat(); - assertTrue(dst_gray_32f.empty()); + dst = new Mat(); + assertTrue(dst.empty()); } public static void assertMatEqual(Mat m1, Mat m2) { diff --git a/modules/java/android_test/src/org/opencv/test/coreTest.java b/modules/java/android_test/src/org/opencv/test/coreTest.java index cede490705..5d1aa65347 100644 --- a/modules/java/android_test/src/org/opencv/test/coreTest.java +++ b/modules/java/android_test/src/org/opencv/test/coreTest.java @@ -19,12 +19,12 @@ public class coreTest extends OpenCVTestCase { Mat lut = new Mat(1, 256, Mat.CvType.CV_8UC1); lut.setTo(0); - core.LUT(grayRnd, lut, dst_gray); - assertMatEqual(gray0, dst_gray); + core.LUT(grayRnd, lut, dst); + assertMatEqual(gray0, dst); lut.setTo(255); - core.LUT(grayRnd, lut, dst_gray); - assertMatEqual(gray255, dst_gray); + core.LUT(grayRnd, lut, dst); + assertMatEqual(gray255, dst); } public void testMahalanobis() { @@ -45,8 +45,8 @@ public class coreTest extends OpenCVTestCase { } public void testAbsdiff() { - core.absdiff(gray128, gray255, dst_gray); - assertMatEqual(gray127, dst_gray); + core.absdiff(gray128, gray255, dst); + assertMatEqual(gray127, dst); } public void testAddMatMatMatMatInt() { @@ -58,8 +58,8 @@ public class coreTest extends OpenCVTestCase { } public void testAddMatMatMat() { - core.add(gray128, gray128, dst_gray); - assertMatEqual(gray255, dst_gray); + core.add(gray128, gray128, dst); + assertMatEqual(gray255, dst); } public void testAddWeightedMatDoubleMatDoubleDoubleMatInt() { @@ -69,8 +69,8 @@ public class coreTest extends OpenCVTestCase { } public void testAddWeightedMatDoubleMatDoubleDoubleMat() { - core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst_gray); - assertMatEqual(gray255, dst_gray); + core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst); + assertMatEqual(gray255, dst); } public void testBitwise_andMatMatMatMat() { @@ -78,8 +78,8 @@ public class coreTest extends OpenCVTestCase { } public void testBitwise_andMatMatMat() { - core.bitwise_and(gray3, gray2, dst_gray); - assertMatEqual(gray2, dst_gray); + core.bitwise_and(gray3, gray2, dst); + assertMatEqual(gray2, dst); } public void testBitwise_notMatMatMat() { @@ -177,14 +177,14 @@ public class coreTest extends OpenCVTestCase { public void testCompleteSymmMatBoolean() { core.completeSymm(grayRnd_32f, true); - core.transpose(grayRnd_32f, dst_gray_32f); - assertMatEqual(grayRnd_32f, dst_gray_32f); + core.transpose(grayRnd_32f, dst); + assertMatEqual(grayRnd_32f, dst); } public void testCompleteSymmMat() { core.completeSymm(grayRnd_32f); - core.transpose(grayRnd_32f, dst_gray_32f); - assertMatEqual(grayRnd_32f, dst_gray_32f); + core.transpose(grayRnd_32f, dst); + assertMatEqual(grayRnd_32f, dst); } public void testConvertScaleAbsMatMatDoubleDouble() { @@ -215,15 +215,15 @@ public class coreTest extends OpenCVTestCase { } public void testDctMatMat() { - core.dct(gray0_32f_1d, dst_gray); - assertMatEqual(gray0_32f_1d, dst_gray); + core.dct(gray0_32f_1d, dst); + assertMatEqual(gray0_32f_1d, dst); Mat in = new Mat(1, 4, Mat.CvType.CV_32FC1); in.put(0, 0, 135.22211, 50.811096, 102.27016, 207.6682); Mat out = new Mat(1, 4, Mat.CvType.CV_32FC1); out.put(0, 0, 247.98576, -61.252407, 94.904533, 14.013477); - core.dct(in, dst_gray); - assertMatEqual(out, dst_gray); + core.dct(in, dst); + assertMatEqual(out, dst); } public void testDeterminant() { @@ -283,8 +283,8 @@ public class coreTest extends OpenCVTestCase { } public void testExtractChannel() { - core.extractChannel(rgba128, dst_gray, 0); - assertMatEqual(gray128, dst_gray); + core.extractChannel(rgba128, dst, 0); + assertMatEqual(gray128, dst); } public void testFastAtan2() { @@ -317,9 +317,9 @@ public class coreTest extends OpenCVTestCase { Mat eConcat = new Mat(1, 9, Mat.CvType.CV_8UC1); e.put(0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1); eConcat.put(0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1); - core.hconcat(e, dst_gray); + core.hconcat(e, dst); - assertMatEqual(eConcat, dst_gray); + assertMatEqual(eConcat, dst); } public void testIdctMatMatInt() { @@ -428,13 +428,13 @@ public class coreTest extends OpenCVTestCase { } public void testMulTransposedMatMatBooleanMat() { - core.mulTransposed(grayRnd_32f, dst_gray_32f, true, grayRnd_32f); - assertMatEqual(gray0_32f, dst_gray_32f); + core.mulTransposed(grayRnd_32f, dst, true, grayRnd_32f); + assertMatEqual(gray0_32f, dst); } public void testMulTransposedMatMatBoolean() { - core.mulTransposed(grayE_32f, dst_gray_32f, true); - assertMatEqual(grayE_32f, dst_gray_32f); + core.mulTransposed(grayE_32f, dst, true); + assertMatEqual(grayE_32f, dst); } public void testMultiplyMatMatMatDoubleInt() { diff --git a/modules/java/android_test/src/org/opencv/test/highguiTest.java b/modules/java/android_test/src/org/opencv/test/highguiTest.java index a3ae391fcd..154ca7673c 100644 --- a/modules/java/android_test/src/org/opencv/test/highguiTest.java +++ b/modules/java/android_test/src/org/opencv/test/highguiTest.java @@ -40,15 +40,19 @@ public class highguiTest extends OpenCVTestCase { } public void testImreadStringInt() { - dst_gray = highgui.imread(LENA, 0); - assertTrue(!dst_gray.empty()); - assertEquals(1, dst_gray.channels()); + dst = highgui.imread(LENA, 0); + assertTrue(!dst.empty()); + assertEquals(1, dst.channels()); + assertTrue(512 == dst.cols()); + assertTrue(512 == dst.rows()); } public void testImreadString() { - dst_gray = highgui.imread(LENA); - assertTrue(!dst_gray.empty()); - assertEquals(3, dst_gray.channels()); + dst = highgui.imread(LENA); + assertTrue(!dst.empty()); + assertEquals(3, dst.channels()); + assertTrue(512 == dst.cols()); + assertTrue(512 == dst.rows()); } public void testImshow() { diff --git a/modules/java/android_test/src/org/opencv/test/imgprocTest.java b/modules/java/android_test/src/org/opencv/test/imgprocTest.java index f6b4a41977..6782ff4f8b 100644 --- a/modules/java/android_test/src/org/opencv/test/imgprocTest.java +++ b/modules/java/android_test/src/org/opencv/test/imgprocTest.java @@ -200,11 +200,11 @@ public class imgprocTest extends OpenCVTestCase { public void testBlurMatMatSize() { Size sz = new Size(3, 3); - imgproc.blur(gray0, dst_gray, sz); - assertMatEqual(gray0, dst_gray); + imgproc.blur(gray0, dst, sz); + assertMatEqual(gray0, dst); - imgproc.blur(gray255, dst_gray, sz); - assertMatEqual(gray255, dst_gray); + imgproc.blur(gray255, dst, sz); + assertMatEqual(gray255, dst); } public void testBorderInterpolate() { @@ -225,8 +225,8 @@ public class imgprocTest extends OpenCVTestCase { public void testBoxFilterMatMatIntSize() { Size sz = new Size(3, 3); - imgproc.boxFilter(gray0, dst_gray, 8, sz); - assertMatEqual(gray0, dst_gray); + imgproc.boxFilter(gray0, dst, 8, sz); + assertMatEqual(gray0, dst); } public void testCompareHist() {