java tests updated: now they independent from android, test methods are sorted alphabetically

pull/13383/head
Kirill Kornyakov 14 years ago
parent f301cda780
commit 85166360f1
  1. 2
      modules/java/android_test/.classpath
  2. 110
      modules/java/android_test/src/org/opencv/test/MatTest.java
  3. 71
      modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
  4. 320
      modules/java/android_test/src/org/opencv/test/coreTest.java
  5. 30
      modules/java/android_test/src/org/opencv/test/highguiTest.java
  6. 968
      modules/java/android_test/src/org/opencv/test/imgprocTest.java
  7. 35
      modules/java/android_test/src/org/opencv/test/utils.java
  8. 4
      modules/java/android_test/src/org/opencv/test/videoTest.java

@ -3,7 +3,7 @@
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/> <classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="OpenCV_src"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="src" path="OpenCV_src"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

@ -8,35 +8,39 @@ public class MatTest extends OpenCVTestCase {
super.test_1("Mat"); super.test_1("Mat");
} }
public void testFinalize() { public void testChannels() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMatLong() { public void testClone() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMatIntIntCvType() { public void testCol() {
Mat gray = new Mat(1, 1, Mat.CvType.CV_8UC1); fail("Not yet implemented");
assertFalse(gray.empty()); }
Mat rgb = new Mat(1, 1, Mat.CvType.CV_8UC3); public void testColRange() {
assertFalse(rgb.empty()); fail("Not yet implemented");
} }
public void testMatIntIntCvTypeDoubleDoubleDoubleDouble() { public void testCols() {
assertEquals(matSize, gray0.rows());
}
public void testCopyTo() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMatIntIntCvTypeDoubleDoubleDouble() { public void testCross() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMatIntIntCvTypeDoubleDouble() { public void testDataAddr() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMatIntIntCvTypeDouble() { public void testDepth() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -44,51 +48,51 @@ public class MatTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testToString() { public void testDot() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testEmpty() { public void testElemSize() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testType() { public void testEmpty() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testDepth() { public void testFinalize() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testChannels() { public void testGetIntIntByteArray() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testElemSize() { public void testGetIntIntDoubleArray() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testRows() { public void testGetIntIntFloatArray() {
assertEquals(matSize, gray0.rows()); fail("Not yet implemented");
} }
public void testHeight() { public void testGetIntIntIntArray() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCols() { public void testGetIntIntShortArray() {
assertEquals(matSize, gray0.rows()); fail("Not yet implemented");
} }
public void testWidth() { public void testGetNativeObjAddr() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testTotal() { public void testHeight() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testDataAddr() { public void testInv() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -100,27 +104,35 @@ public class MatTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSubmat() { public void testMatIntIntCvType() {
Mat gray = new Mat(1, 1, Mat.CvType.CV_8UC1);
assertFalse(gray.empty());
Mat rgb = new Mat(1, 1, Mat.CvType.CV_8UC3);
assertFalse(rgb.empty());
}
public void testMatIntIntCvTypeDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testRowRange() { public void testMatIntIntCvTypeDoubleDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testRow() { public void testMatIntIntCvTypeDoubleDoubleDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testColRange() { public void testMatIntIntCvTypeDoubleDoubleDoubleDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCol() { public void testMatLong() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testClone() { public void testPutIntIntByteArray() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -140,31 +152,23 @@ public class MatTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testPutIntIntByteArray() { public void testRow() {
fail("Not yet implemented");
}
public void testGetIntIntByteArray() {
fail("Not yet implemented");
}
public void testGetIntIntShortArray() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testGetIntIntIntArray() { public void testRowRange() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testGetIntIntFloatArray() { public void testRows() {
fail("Not yet implemented"); assertEquals(matSize, gray0.rows());
} }
public void testGetIntIntDoubleArray() { public void testSetToDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSetToDoubleDoubleDoubleDouble() { public void testSetToDoubleDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -172,31 +176,27 @@ public class MatTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSetToDoubleDouble() { public void testSetToDoubleDoubleDoubleDouble() {
fail("Not yet implemented");
}
public void testSetToDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCopyTo() { public void testSubmat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testDot() { public void testToString() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCross() { public void testTotal() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testInv() { public void testType() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testGetNativeObjAddr() { public void testWidth() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
} }

@ -1,26 +1,21 @@
package org.opencv.test; package org.opencv.test;
import java.io.FileOutputStream; import junit.framework.TestCase;
import org.opencv.Mat; import org.opencv.Mat;
import org.opencv.core; import org.opencv.core;
import org.opencv.highgui; import org.opencv.highgui;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap.CompressFormat;
import android.test.AndroidTestCase;
import android.util.Log;
public class OpenCVTestCase extends AndroidTestCase { public class OpenCVTestCase extends TestCase {
static String TAG = "OpenCV_JavaAPI_Tests";
static String LENA = "/data/data/org.opencv.test/files/lena.jpg"; static String LENA = "/data/data/org.opencv.test/files/lena.jpg";
static int matSize = 10; static int matSize = 10;
//Naming notation: channels_[type]_[dimension]_value static Mat dst;
//Naming notation: <channels info>_[depth]_[dimensions]_value
//examples: gray0 - single channel 8U 2d Mat filled with 0 //examples: gray0 - single channel 8U 2d Mat filled with 0
// grayRnd - single channel 8U 2d Mat filled with random numbers // grayRnd - single channel 8U 2d Mat filled with random numbers
// gray0_32f_1d - refactor ;) // gray0_32f_1d - refactor ;)
@ -32,72 +27,56 @@ public class OpenCVTestCase extends AndroidTestCase {
static Mat gray127; static Mat gray127;
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 gray0_32f;
static Mat gray255_32f;
static Mat grayE_32f; static Mat grayE_32f;
static Mat grayRnd_32f;
static Mat gray0_32f;
static Mat gray0_32f_1d; static Mat gray0_32f_1d;
static Mat gray0_64f; static Mat gray0_64f;
static Mat gray0_64f_1d; static Mat gray0_64f_1d;
static Mat rgba0;
static Mat rgba128;
static Mat rgbLena; static Mat rgbLena;
static Mat dst; static Mat rgba0;
static Mat rgba128;
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
dst = new Mat();
assertTrue(dst.empty());
gray0 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray0.setTo(0.0); 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); gray1 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray1.setTo(1.0);
gray2 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray2.setTo(2.0); gray2 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray2.setTo(2.0);
gray3 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray3.setTo(3.0); gray3 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray3.setTo(3.0);
gray127 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray127.setTo(127.0); gray127 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray127.setTo(127.0);
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(255.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, 0.0);
Mat high = new Mat(1, 1, Mat.CvType.CV_16UC1); high.setTo(256); Mat high = new Mat(1, 1, Mat.CvType.CV_16UC1, 256.0);
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);
grayRnd_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); core.randu(grayRnd_32f, low, high);
gray0_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); gray0_32f.setTo(0.0);
gray255_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); gray255_32f.setTo(255.0);
grayE_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); grayE_32f = Mat.eye(matSize, matSize, Mat.CvType.CV_32FC1); grayE_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); grayE_32f = Mat.eye(matSize, matSize, Mat.CvType.CV_32FC1);
grayRnd_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); core.randu(grayRnd_32f, low, high);
gray0_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); gray0_32f.setTo(0.0);
gray0_32f_1d = new Mat(1, matSize, Mat.CvType.CV_32FC1); gray0_32f_1d.setTo(0.0); gray0_32f_1d = new Mat(1, matSize, Mat.CvType.CV_32FC1); gray0_32f_1d.setTo(0.0);
gray0_64f = new Mat(matSize, matSize, Mat.CvType.CV_64FC1); gray0_64f.setTo(0.0); gray0_64f = new Mat(matSize, matSize, Mat.CvType.CV_64FC1); gray0_64f.setTo(0.0);
gray0_64f_1d = new Mat(1, matSize, Mat.CvType.CV_64FC1); gray0_64f_1d.setTo(0.0); gray0_64f_1d = new Mat(1, matSize, Mat.CvType.CV_64FC1); gray0_64f_1d.setTo(0.0);
rgbLena = highgui.imread(LENA);
rgba0 = new Mat(matSize, matSize, Mat.CvType.CV_8UC4); rgba0.setTo(0, 0, 0, 0); rgba0 = new Mat(matSize, matSize, Mat.CvType.CV_8UC4); rgba0.setTo(0, 0, 0, 0);
rgba128 = new Mat(matSize, matSize, Mat.CvType.CV_8UC4); rgba128.setTo(128, 128, 128, 128); rgba128 = new Mat(matSize, matSize, Mat.CvType.CV_8UC4); rgba128.setTo(128, 128, 128, 128);
try {
Bitmap mBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.drawable.lena);
FileOutputStream fos = this.getContext().openFileOutput("lena.jpg", Context.MODE_WORLD_READABLE);
mBitmap.compress(CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
}
catch (Exception e) {
Log.e(TAG, "Tried to write lena.jpg, but: " + e.toString());
}
rgbLena = highgui.imread(LENA);
dst = new Mat();
assertTrue(dst.empty());
} }
public static void assertMatEqual(Mat m1, Mat m2) { public static void assertMatEqual(Mat m1, Mat m2) {
@ -114,8 +93,10 @@ public class OpenCVTestCase extends AndroidTestCase {
} }
public void test_1(String label) { public void test_1(String label) {
Log.e(TAG, "================================================"); utils.Log("================================================");
Log.e(TAG, "=============== " + label); utils.Log("=============== " + label);
Log.e(TAG, "================================================"); utils.Log("================================================");
new utils().ExportLena();
} }
} }

@ -11,61 +11,22 @@ public class coreTest extends OpenCVTestCase {
super.test_1("CORE"); super.test_1("CORE");
} }
public void testLUTMatMatMatInt() {
fail("Not yet implemented");
}
public void testLUTMatMatMat() {
Mat lut = new Mat(1, 256, Mat.CvType.CV_8UC1);
lut.setTo(0);
core.LUT(grayRnd, lut, dst);
assertMatEqual(gray0, dst);
lut.setTo(255);
core.LUT(grayRnd, lut, dst);
assertMatEqual(gray255, dst);
}
public void testMahalanobis() {
Mat covar = new Mat(matSize, matSize, Mat.CvType.CV_32FC1);
Mat mean = new Mat(1, matSize, Mat.CvType.CV_32FC1);
core.calcCovarMatrix(grayRnd_32f, covar, mean, 8|1, Mat.CvType.CV_32F); //FIXME: CV_COVAR_NORMAL instead of magic numbers
covar.inv();
Mat line1 = grayRnd_32f.submat(0, 1, 0, grayRnd_32f.cols());
Mat line2 = grayRnd_32f.submat(1, 2, 0, grayRnd_32f.cols());
double d = 0.0;
d = core.Mahalanobis(line1, line1, covar);
assertEquals(0.0, d);
d = core.Mahalanobis(line1, line2, covar);
assertTrue(d > 0.0);
}
public void testAbsdiff() { public void testAbsdiff() {
core.absdiff(gray128, gray255, dst); core.absdiff(gray128, gray255, dst);
assertMatEqual(gray127, dst); assertMatEqual(gray127, dst);
} }
public void testAddMatMatMatMatInt() { public void testAddMatMatMat() {
fail("Not yet implemented"); core.add(gray128, gray128, dst);
assertMatEqual(gray255, dst);
} }
public void testAddMatMatMatMat() { public void testAddMatMatMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testAddMatMatMat() { public void testAddMatMatMatMatInt() {
core.add(gray128, gray128, dst); fail("Not yet implemented");
assertMatEqual(gray255, dst);
}
public void testAddWeightedMatDoubleMatDoubleDoubleMatInt() {
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() {
@ -73,8 +34,9 @@ public class coreTest extends OpenCVTestCase {
assertMatEqual(gray255, dst); assertMatEqual(gray255, dst);
} }
public void testBitwise_andMatMatMatMat() { public void testAddWeightedMatDoubleMatDoubleDoubleMatInt() {
fail("Not yet implemented"); core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst, gray255_32f.depth());
assertTrue(core.CV_32F == dst.depth());
} }
public void testBitwise_andMatMatMat() { public void testBitwise_andMatMatMat() {
@ -82,7 +44,7 @@ public class coreTest extends OpenCVTestCase {
assertMatEqual(gray2, dst); assertMatEqual(gray2, dst);
} }
public void testBitwise_notMatMatMat() { public void testBitwise_andMatMatMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -90,7 +52,7 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testBitwise_orMatMatMatMat() { public void testBitwise_notMatMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -98,7 +60,7 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testBitwise_xorMatMatMatMat() { public void testBitwise_orMatMatMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -106,50 +68,42 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCalcCovarMatrixMatMatMatIntInt() { public void testBitwise_xorMatMatMatMat() {
Mat covar = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); fail("Not yet implemented");
Mat mean = new Mat(1, matSize, Mat.CvType.CV_32FC1);
core.calcCovarMatrix(gray0_32f, covar, mean, 8|1, Mat.CvType.CV_32F); //FIXME: CV_COVAR_NORMAL instead of magic numbers
assertMatEqual(gray0_32f, covar);
assertMatEqual(gray0_32f_1d, mean);
} }
public void testCalcCovarMatrixMatMatMatInt() { public void testCalcCovarMatrixMatMatMatInt() {
Mat covar = new Mat(matSize, matSize, Mat.CvType.CV_64FC1); Mat covar = new Mat(matSize, matSize, Mat.CvType.CV_64FC1);
Mat mean = new Mat(1, matSize, Mat.CvType.CV_64FC1); Mat mean = new Mat(1, matSize, Mat.CvType.CV_64FC1);
core.calcCovarMatrix(gray0_32f, covar, mean, 8|1); //FIXME: CV_COVAR_NORMAL instead of magic numbers core.calcCovarMatrix(gray0_32f, covar, mean, 8|1); //TODO: CV_COVAR_NORMAL instead of magic numbers
assertMatEqual(gray0_64f, covar); assertMatEqual(gray0_64f, covar);
assertMatEqual(gray0_64f_1d, mean); assertMatEqual(gray0_64f_1d, mean);
} }
public void testCartToPolarMatMatMatMatBoolean() { public void testCalcCovarMatrixMatMatMatIntInt() {
fail("Not yet implemented"); Mat covar = new Mat(matSize, matSize, Mat.CvType.CV_32FC1);
Mat mean = new Mat(1, matSize, Mat.CvType.CV_32FC1);
core.calcCovarMatrix(gray0_32f, covar, mean, 8|1, Mat.CvType.CV_32F); //TODO: CV_COVAR_NORMAL instead of magic numbers
assertMatEqual(gray0_32f, covar);
assertMatEqual(gray0_32f_1d, mean);
} }
public void testCartToPolarMatMatMatMat() { public void testCartToPolarMatMatMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCartToPolarMatMatMatMatBoolean() {
fail("Not yet implemented");
}
public void testCheckHardwareSupport() { public void testCheckHardwareSupport() {
//FIXME: do we need this function? //FIXME: do we need this function?
boolean hasFeauture = core.checkHardwareSupport(0); boolean hasFeauture = core.checkHardwareSupport(0);
assertEquals(false, hasFeauture); assertEquals(false, hasFeauture);
} }
public void testCircleMatPointIntScalarIntIntInt() {
fail("Not yet implemented");
}
public void testCircleMatPointIntScalarIntInt() {
fail("Not yet implemented");
}
public void testCircleMatPointIntScalarInt() {
fail("Not yet implemented");
}
public void testCircleMatPointIntScalar() { public void testCircleMatPointIntScalar() {
Point center = new Point(gray0.cols() / 2, gray0.rows()/2); Point center = new Point(gray0.cols() / 2, gray0.rows()/2);
int radius = Math.min(gray0.cols()/4, gray0.rows()/4); int radius = Math.min(gray0.cols()/4, gray0.rows()/4);
@ -160,6 +114,18 @@ public class coreTest extends OpenCVTestCase {
assertTrue(0 != core.countNonZero(gray0)); assertTrue(0 != core.countNonZero(gray0));
} }
public void testCircleMatPointIntScalarInt() {
fail("Not yet implemented");
}
public void testCircleMatPointIntScalarIntInt() {
fail("Not yet implemented");
}
public void testCircleMatPointIntScalarIntIntInt() {
fail("Not yet implemented");
}
public void testCompare() { public void testCompare() {
Mat cmp = new Mat(0, 0, Mat.CvType.CV_8UC1); Mat cmp = new Mat(0, 0, Mat.CvType.CV_8UC1);
@ -172,22 +138,22 @@ public class coreTest extends OpenCVTestCase {
core.compare(gray0, grayRnd, cmp, core.CMP_EQ); core.compare(gray0, grayRnd, cmp, core.CMP_EQ);
double nBlackPixels = core.countNonZero(cmp); double nBlackPixels = core.countNonZero(cmp);
double nNonBlackpixels = core.countNonZero(grayRnd); double nNonBlackpixels = core.countNonZero(grayRnd);
assertTrue((nBlackPixels+nNonBlackpixels) == grayRnd.rows()*grayRnd.cols()); assertTrue((nBlackPixels + nNonBlackpixels) == grayRnd.total());
} }
public void testCompleteSymmMatBoolean() { public void testCompleteSymmMat() {
core.completeSymm(grayRnd_32f, true); core.completeSymm(grayRnd_32f);
core.transpose(grayRnd_32f, dst); core.transpose(grayRnd_32f, dst);
assertMatEqual(grayRnd_32f, dst); assertMatEqual(grayRnd_32f, dst);
} }
public void testCompleteSymmMat() { public void testCompleteSymmMatBoolean() {
core.completeSymm(grayRnd_32f); core.completeSymm(grayRnd_32f, true);
core.transpose(grayRnd_32f, dst); core.transpose(grayRnd_32f, dst);
assertMatEqual(grayRnd_32f, dst); assertMatEqual(grayRnd_32f, dst);
} }
public void testConvertScaleAbsMatMatDoubleDouble() { public void testConvertScaleAbsMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -195,7 +161,7 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testConvertScaleAbsMatMat() { public void testConvertScaleAbsMatMatDoubleDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -210,10 +176,6 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testDctMatMatInt() {
fail("Not yet implemented");
}
public void testDctMatMat() { public void testDctMatMat() {
core.dct(gray0_32f_1d, dst); core.dct(gray0_32f_1d, dst);
assertMatEqual(gray0_32f_1d, dst); assertMatEqual(gray0_32f_1d, dst);
@ -222,15 +184,20 @@ public class coreTest extends OpenCVTestCase {
in.put(0, 0, 135.22211, 50.811096, 102.27016, 207.6682); in.put(0, 0, 135.22211, 50.811096, 102.27016, 207.6682);
Mat out = new Mat(1, 4, Mat.CvType.CV_32FC1); Mat out = new Mat(1, 4, Mat.CvType.CV_32FC1);
out.put(0, 0, 247.98576, -61.252407, 94.904533, 14.013477); out.put(0, 0, 247.98576, -61.252407, 94.904533, 14.013477);
core.dct(in, dst); core.dct(in, dst);
assertMatEqual(out, dst); assertMatEqual(out, dst);
} }
public void testDctMatMatInt() {
fail("Not yet implemented");
}
public void testDeterminant() { public void testDeterminant() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testDftMatMatIntInt() { public void testDftMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -238,15 +205,15 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testDftMatMat() { public void testDftMatMatIntInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testDivideMatMatMatDoubleInt() { public void testDivideDoubleMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testDivideMatMatMatDouble() { public void testDivideDoubleMatMatInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -254,27 +221,27 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testDivideDoubleMatMatInt() { public void testDivideMatMatMatDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testDivideDoubleMatMat() { public void testDivideMatMatMatDoubleInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testEllipseMatPointSizeDoubleDoubleDoubleScalarIntIntInt() { public void testEllipseMatPointSizeDoubleDoubleDoubleScalar() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testEllipseMatPointSizeDoubleDoubleDoubleScalarIntInt() { public void testEllipseMatPointSizeDoubleDoubleDoubleScalarInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testEllipseMatPointSizeDoubleDoubleDoubleScalarInt() { public void testEllipseMatPointSizeDoubleDoubleDoubleScalarIntInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testEllipseMatPointSizeDoubleDoubleDoubleScalar() { public void testEllipseMatPointSizeDoubleDoubleDoubleScalarIntIntInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -295,11 +262,11 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testGemmMatMatDoubleMatDoubleMatInt() { public void testGemmMatMatDoubleMatDoubleMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testGemmMatMatDoubleMatDoubleMat() { public void testGemmMatMatDoubleMatDoubleMatInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -317,20 +284,20 @@ public class coreTest extends OpenCVTestCase {
Mat eConcat = new Mat(1, 9, Mat.CvType.CV_8UC1); Mat eConcat = new Mat(1, 9, Mat.CvType.CV_8UC1);
e.put(0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1); 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); eConcat.put(0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1);
core.hconcat(e, dst);
core.hconcat(e, dst);
assertMatEqual(eConcat, dst); assertMatEqual(eConcat, dst);
} }
public void testIdctMatMatInt() { public void testIdctMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testIdctMatMat() { public void testIdctMatMatInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testIdftMatMatIntInt() { public void testIdftMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -338,7 +305,7 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testIdftMatMat() { public void testIdftMatMatIntInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -354,23 +321,11 @@ public class coreTest extends OpenCVTestCase {
//assertMatEqual(rgba0, rgba128); //assertMatEqual(rgba0, rgba128);
} }
public void testInvertMatMatInt() {
fail("Not yet implemented");
}
public void testInvertMatMat() { public void testInvertMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testLineMatPointPointScalarIntIntInt() { public void testInvertMatMatInt() {
fail("Not yet implemented");
}
public void testLineMatPointPointScalarIntInt() {
fail("Not yet implemented");
}
public void testLineMatPointPointScalarInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -386,19 +341,60 @@ public class coreTest extends OpenCVTestCase {
assertTrue(nPoints == core.countNonZero(gray0)); assertTrue(nPoints == core.countNonZero(gray0));
} }
public void testLineMatPointPointScalarInt() {
fail("Not yet implemented");
}
public void testLineMatPointPointScalarIntInt() {
fail("Not yet implemented");
}
public void testLineMatPointPointScalarIntIntInt() {
fail("Not yet implemented");
}
public void testLog() { public void testLog() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMagnitude() { public void testLUTMatMatMat() {
Mat lut = new Mat(1, 256, Mat.CvType.CV_8UC1);
lut.setTo(0);
core.LUT(grayRnd, lut, dst);
assertMatEqual(gray0, dst);
lut.setTo(255);
core.LUT(grayRnd, lut, dst);
assertMatEqual(gray255, dst);
}
public void testLUTMatMatMatInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMax() { public void testMagnitude() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMeanStdDevMatMatMatMat() { public void testMahalanobis() {
Mat covar = new Mat(matSize, matSize, Mat.CvType.CV_32FC1);
Mat mean = new Mat(1, matSize, Mat.CvType.CV_32FC1);
core.calcCovarMatrix(grayRnd_32f, covar, mean, 8|1, Mat.CvType.CV_32F); //TODO: CV_COVAR_NORMAL instead of magic numbers
covar.inv();
Mat line1 = grayRnd_32f.submat(0, 1, 0, grayRnd_32f.cols());
Mat line2 = grayRnd_32f.submat(1, 2, 0, grayRnd_32f.cols());
double d = 0.0;
d = core.Mahalanobis(line1, line1, covar);
assertEquals(0.0, d);
d = core.Mahalanobis(line1, line2, covar);
assertTrue(d > 0.0);
}
public void testMax() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -406,11 +402,11 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMin() { public void testMeanStdDevMatMatMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMulSpectrumsMatMatMatIntBoolean() { public void testMin() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -419,17 +415,20 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMulTransposedMatMatBooleanMatDoubleInt() { public void testMulSpectrumsMatMatMatIntBoolean() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMulTransposedMatMatBooleanMatDouble() { public void testMultiplyMatMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMulTransposedMatMatBooleanMat() { public void testMultiplyMatMatMatDouble() {
core.mulTransposed(grayRnd_32f, dst, true, grayRnd_32f); fail("Not yet implemented");
assertMatEqual(gray0_32f, dst); }
public void testMultiplyMatMatMatDoubleInt() {
fail("Not yet implemented");
} }
public void testMulTransposedMatMatBoolean() { public void testMulTransposedMatMatBoolean() {
@ -437,40 +436,36 @@ public class coreTest extends OpenCVTestCase {
assertMatEqual(grayE_32f, dst); assertMatEqual(grayE_32f, dst);
} }
public void testMultiplyMatMatMatDoubleInt() { public void testMulTransposedMatMatBooleanMat() {
fail("Not yet implemented"); core.mulTransposed(grayRnd_32f, dst, true, grayRnd_32f);
assertMatEqual(gray0_32f, dst);
} }
public void testMultiplyMatMatMatDouble() { public void testMulTransposedMatMatBooleanMatDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMultiplyMatMatMat() { public void testMulTransposedMatMatBooleanMatDoubleInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testNormMatIntMat() { public void testNormalizeMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testNormMatInt() { public void testNormalizeMatMatDouble() {
double n = core.norm(gray127, core.NORM_INF);
assertTrue(127 == n);
}
public void testNormMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testNormMatMatIntMat() { public void testNormalizeMatMatDoubleDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testNormMatMatInt() { public void testNormalizeMatMatDoubleDoubleInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testNormMatMat() { public void testNormalizeMatMatDoubleDoubleIntInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -478,23 +473,28 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testNormalizeMatMatDoubleDoubleIntInt() { public void testNormMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testNormalizeMatMatDoubleDoubleInt() { public void testNormMatInt() {
double n = core.norm(gray127, core.NORM_INF);
assertTrue(127 == n);
}
public void testNormMatIntMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testNormalizeMatMatDoubleDouble() { public void testNormMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testNormalizeMatMatDouble() { public void testNormMatMatInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testNormalizeMatMat() { public void testNormMatMatIntMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -503,19 +503,19 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testPhaseMatMatMatBoolean() { public void testPhaseMatMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testPhaseMatMatMat() { public void testPhaseMatMatMatBoolean() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testPolarToCartMatMatMatMatBoolean() { public void testPolarToCartMatMatMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testPolarToCartMatMatMatMat() { public void testPolarToCartMatMatMatMatBoolean() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -531,27 +531,27 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testRectangleMatPointPointScalarIntIntInt() { public void testRectangleMatPointPointScalar() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testRectangleMatPointPointScalarIntInt() { public void testRectangleMatPointPointScalarInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testRectangleMatPointPointScalarInt() { public void testRectangleMatPointPointScalarIntInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testRectangleMatPointPointScalar() { public void testRectangleMatPointPointScalarIntIntInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testReduceMatMatIntIntInt() { public void testReduceMatMatIntInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testReduceMatMatIntInt() { public void testReduceMatMatIntIntInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -563,20 +563,20 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSetIdentityMatScalar() { public void testSetIdentityMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSetIdentityMat() { public void testSetIdentityMatScalar() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSetUseOptimized() { public void testSetUseOptimized() {
//FIXME: do we need this function? //XXX: do we need this function?
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSolveMatMatMatInt() { public void testSolveCubic() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -584,15 +584,15 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSolveCubic() { public void testSolveMatMatMatInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSolvePolyMatMatInt() { public void testSolvePolyMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSolvePolyMatMat() { public void testSolvePolyMatMatInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -608,7 +608,7 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSubtractMatMatMatMatInt() { public void testSubtractMatMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -616,7 +616,7 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSubtractMatMatMat() { public void testSubtractMatMatMatMatInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }

@ -1,16 +1,7 @@
package org.opencv.test; package org.opencv.test;
import java.io.FileOutputStream;
import org.opencv.Mat;
import org.opencv.highgui; import org.opencv.highgui;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
import android.util.Log;
public class highguiTest extends OpenCVTestCase { public class highguiTest extends OpenCVTestCase {
@ -39,32 +30,33 @@ public class highguiTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testImreadStringInt() { public void testImreadString() {
dst = highgui.imread(LENA, 0); dst = highgui.imread(LENA);
assertTrue(!dst.empty()); assertTrue(!dst.empty());
assertEquals(1, dst.channels()); assertEquals(3, dst.channels());
assertTrue(512 == dst.cols()); assertTrue(512 == dst.cols());
assertTrue(512 == dst.rows()); assertTrue(512 == dst.rows());
} }
public void testImreadString() { public void testImreadStringInt() {
dst = highgui.imread(LENA); dst = highgui.imread(LENA, 0);
assertTrue(!dst.empty()); assertTrue(!dst.empty());
assertEquals(3, dst.channels()); assertEquals(1, dst.channels());
assertTrue(512 == dst.cols()); assertTrue(512 == dst.cols());
assertTrue(512 == dst.rows()); assertTrue(512 == dst.rows());
} }
public void testImshow() { public void testImshow() {
//XXX: do we need this function?
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testNamedWindowStringInt() { public void testNamedWindowString() {
//XXX: do not export this function //XXX: do not export this function
fail("Do not export this function"); fail("Do not export this function");
} }
public void testNamedWindowString() { public void testNamedWindowStringInt() {
//XXX: do not export this function //XXX: do not export this function
fail("Do not export this function"); fail("Do not export this function");
} }
@ -84,12 +76,12 @@ public class highguiTest extends OpenCVTestCase {
fail("Do not export this function"); fail("Do not export this function");
} }
public void testWaitKeyInt() { public void testWaitKey() {
//XXX: we need this function if only imshow will be implemented //XXX: we need this function if only imshow will be implemented
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testWaitKey() { public void testWaitKeyInt() {
//XXX: we need this function if only imshow will be implemented //XXX: we need this function if only imshow will be implemented
fail("Not yet implemented"); fail("Not yet implemented");
} }

@ -0,0 +1,35 @@
package org.opencv.test;
import java.io.FileOutputStream;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap.CompressFormat;
import android.test.AndroidTestCase;
import android.util.Log;
public class utils extends AndroidTestCase {
static String TAG = "opencv_test_java";
static public void Log(String message) {
Log.e(TAG, message);
}
public void ExportLena() {
//TODO: can we run this code just once, not for every test case?
try {
Bitmap mBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.drawable.lena);
FileOutputStream fos = this.getContext().openFileOutput("lena.jpg", Context.MODE_WORLD_READABLE);
mBitmap.compress(CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
}
catch (Exception e) {
Log.e(TAG, "Tried to write lena.jpg, but: " + e.toString());
}
}
}

@ -7,11 +7,11 @@ public class videoTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCalcMotionGradientMatMatMatDoubleDoubleInt() { public void testCalcMotionGradientMatMatMatDoubleDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCalcMotionGradientMatMatMatDoubleDouble() { public void testCalcMotionGradientMatMatMatDoubleDoubleInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }

Loading…
Cancel
Save