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

This commit is contained in:
Kirill Kornyakov 2011-07-04 12:21:56 +00:00
parent f301cda780
commit 85166360f1
8 changed files with 939 additions and 931 deletions

View File

@ -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>

View File

@ -8,71 +8,19 @@ public class MatTest extends OpenCVTestCase {
super.test_1("Mat"); super.test_1("Mat");
} }
public void testFinalize() {
fail("Not yet implemented");
}
public void testMatLong() {
fail("Not yet implemented");
}
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 testMatIntIntCvTypeDoubleDoubleDoubleDouble() {
fail("Not yet implemented");
}
public void testMatIntIntCvTypeDoubleDoubleDouble() {
fail("Not yet implemented");
}
public void testMatIntIntCvTypeDoubleDouble() {
fail("Not yet implemented");
}
public void testMatIntIntCvTypeDouble() {
fail("Not yet implemented");
}
public void testDispose() {
fail("Not yet implemented");
}
public void testToString() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testType() {
fail("Not yet implemented");
}
public void testDepth() {
fail("Not yet implemented");
}
public void testChannels() { public void testChannels() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testElemSize() { public void testClone() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testRows() { public void testCol() {
assertEquals(matSize, gray0.rows()); fail("Not yet implemented");
} }
public void testHeight() { public void testColRange() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -80,11 +28,11 @@ public class MatTest extends OpenCVTestCase {
assertEquals(matSize, gray0.rows()); assertEquals(matSize, gray0.rows());
} }
public void testWidth() { public void testCopyTo() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testTotal() { public void testCross() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -92,6 +40,62 @@ public class MatTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testDepth() {
fail("Not yet implemented");
}
public void testDispose() {
fail("Not yet implemented");
}
public void testDot() {
fail("Not yet implemented");
}
public void testElemSize() {
fail("Not yet implemented");
}
public void testEmpty() {
fail("Not yet implemented");
}
public void testFinalize() {
fail("Not yet implemented");
}
public void testGetIntIntByteArray() {
fail("Not yet implemented");
}
public void testGetIntIntDoubleArray() {
fail("Not yet implemented");
}
public void testGetIntIntFloatArray() {
fail("Not yet implemented");
}
public void testGetIntIntIntArray() {
fail("Not yet implemented");
}
public void testGetIntIntShortArray() {
fail("Not yet implemented");
}
public void testGetNativeObjAddr() {
fail("Not yet implemented");
}
public void testHeight() {
fail("Not yet implemented");
}
public void testInv() {
fail("Not yet implemented");
}
public void testIsContinuous() { public void testIsContinuous() {
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,35 +152,19 @@ public class MatTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testPutIntIntByteArray() { public void testRow() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testGetIntIntByteArray() { public void testRowRange() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testGetIntIntShortArray() { public void testRows() {
fail("Not yet implemented"); assertEquals(matSize, gray0.rows());
} }
public void testGetIntIntIntArray() { public void testSetToDouble() {
fail("Not yet implemented");
}
public void testGetIntIntFloatArray() {
fail("Not yet implemented");
}
public void testGetIntIntDoubleArray() {
fail("Not yet implemented");
}
public void testSetToDoubleDoubleDoubleDouble() {
fail("Not yet implemented");
}
public void testSetToDoubleDoubleDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -176,27 +172,31 @@ public class MatTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSetToDouble() { public void testSetToDoubleDoubleDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCopyTo() { public void testSetToDoubleDoubleDoubleDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testDot() { public void testSubmat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testCross() { public void testToString() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testInv() { public void testTotal() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testGetNativeObjAddr() { public void testType() {
fail("Not yet implemented");
}
public void testWidth() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
} }

View File

@ -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 ;)
@ -31,31 +26,30 @@ public class OpenCVTestCase extends AndroidTestCase {
static Mat gray3; static Mat gray3;
static Mat gray127; static Mat gray127;
static Mat gray128; static Mat gray128;
static Mat gray255; static Mat gray255;
static Mat grayRnd;
static Mat gray255_32f;
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);
@ -63,41 +57,26 @@ public class OpenCVTestCase extends AndroidTestCase {
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, 0.0);
Mat high = new Mat(1, 1, Mat.CvType.CV_16UC1, 256.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);
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);
grayE_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); grayE_32f = Mat.eye(matSize, matSize, Mat.CvType.CV_32FC1);
gray0_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); gray0_32f.setTo(0.0); 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);
grayRnd_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); core.randu(grayRnd_32f, low, high);
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();
} }
} }

View File

@ -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() {
fail("Not yet implemented");
}
public void testAddMatMatMatMat() {
fail("Not yet implemented");
}
public void testAddMatMatMat() { public void testAddMatMatMat() {
core.add(gray128, gray128, dst); core.add(gray128, gray128, dst);
assertMatEqual(gray255, dst); assertMatEqual(gray255, dst);
} }
public void testAddWeightedMatDoubleMatDoubleDoubleMatInt() { public void testAddMatMatMatMat() {
Mat dst = new Mat(); fail("Not yet implemented");
core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst, gray255_32f.depth()); }
assertTrue(gray255_32f.depth() == dst.depth());
public void testAddMatMatMatMatInt() {
fail("Not yet implemented");
} }
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,13 +138,7 @@ 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() {
core.completeSymm(grayRnd_32f, true);
core.transpose(grayRnd_32f, dst);
assertMatEqual(grayRnd_32f, dst);
} }
public void testCompleteSymmMat() { public void testCompleteSymmMat() {
@ -187,7 +147,13 @@ public class coreTest extends OpenCVTestCase {
assertMatEqual(grayRnd_32f, dst); assertMatEqual(grayRnd_32f, dst);
} }
public void testConvertScaleAbsMatMatDoubleDouble() { public void testCompleteSymmMatBoolean() {
core.completeSymm(grayRnd_32f, true);
core.transpose(grayRnd_32f, dst);
assertMatEqual(grayRnd_32f, dst);
}
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,39 +184,28 @@ 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() {
fail("Not yet implemented");
}
public void testDftMatMatInt() {
fail("Not yet implemented");
}
public void testDftMatMat() { public void testDftMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testDivideMatMatMatDoubleInt() { public void testDftMatMatInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testDivideMatMatMatDouble() { public void testDftMatMatIntInt() {
fail("Not yet implemented");
}
public void testDivideMatMatMat() {
fail("Not yet implemented");
}
public void testDivideDoubleMatMatInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -262,11 +213,23 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testEllipseMatPointSizeDoubleDoubleDoubleScalarIntIntInt() { public void testDivideDoubleMatMatInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testEllipseMatPointSizeDoubleDoubleDoubleScalarIntInt() { public void testDivideMatMatMat() {
fail("Not yet implemented");
}
public void testDivideMatMatMatDouble() {
fail("Not yet implemented");
}
public void testDivideMatMatMatDoubleInt() {
fail("Not yet implemented");
}
public void testEllipseMatPointSizeDoubleDoubleDoubleScalar() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -274,7 +237,11 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testEllipseMatPointSizeDoubleDoubleDoubleScalar() { public void testEllipseMatPointSizeDoubleDoubleDoubleScalarIntInt() {
fail("Not yet implemented");
}
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() {
fail("Not yet implemented");
}
public void testIdctMatMat() { public void testIdctMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testIdftMatMatIntInt() { public void testIdctMatMatInt() {
fail("Not yet implemented");
}
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 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");
}
public void testMagnitude() { public void testMagnitude() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMax() { public void testMahalanobis() {
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(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 testMeanStdDevMatMatMatMat() { 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,29 +415,7 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testMulTransposedMatMatBooleanMatDoubleInt() { public void testMulSpectrumsMatMatMatIntBoolean() {
fail("Not yet implemented");
}
public void testMulTransposedMatMatBooleanMatDouble() {
fail("Not yet implemented");
}
public void testMulTransposedMatMatBooleanMat() {
core.mulTransposed(grayRnd_32f, dst, true, grayRnd_32f);
assertMatEqual(gray0_32f, dst);
}
public void testMulTransposedMatMatBoolean() {
core.mulTransposed(grayE_32f, dst, true);
assertMatEqual(grayE_32f, dst);
}
public void testMultiplyMatMatMatDoubleInt() {
fail("Not yet implemented");
}
public void testMultiplyMatMatMatDouble() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -449,7 +423,57 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testNormMatIntMat() { public void testMultiplyMatMatMatDouble() {
fail("Not yet implemented");
}
public void testMultiplyMatMatMatDoubleInt() {
fail("Not yet implemented");
}
public void testMulTransposedMatMatBoolean() {
core.mulTransposed(grayE_32f, dst, true);
assertMatEqual(grayE_32f, dst);
}
public void testMulTransposedMatMatBooleanMat() {
core.mulTransposed(grayRnd_32f, dst, true, grayRnd_32f);
assertMatEqual(gray0_32f, dst);
}
public void testMulTransposedMatMatBooleanMatDouble() {
fail("Not yet implemented");
}
public void testMulTransposedMatMatBooleanMatDoubleInt() {
fail("Not yet implemented");
}
public void testNormalizeMatMat() {
fail("Not yet implemented");
}
public void testNormalizeMatMatDouble() {
fail("Not yet implemented");
}
public void testNormalizeMatMatDoubleDouble() {
fail("Not yet implemented");
}
public void testNormalizeMatMatDoubleDoubleInt() {
fail("Not yet implemented");
}
public void testNormalizeMatMatDoubleDoubleIntInt() {
fail("Not yet implemented");
}
public void testNormalizeMatMatDoubleDoubleIntIntMat() {
fail("Not yet implemented");
}
public void testNormMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -458,15 +482,7 @@ public class coreTest extends OpenCVTestCase {
assertTrue(127 == n); assertTrue(127 == n);
} }
public void testNormMat() { public void testNormMatIntMat() {
fail("Not yet implemented");
}
public void testNormMatMatIntMat() {
fail("Not yet implemented");
}
public void testNormMatMatInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -474,27 +490,11 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testNormalizeMatMatDoubleDoubleIntIntMat() { public void testNormMatMatInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testNormalizeMatMatDoubleDoubleIntInt() { public void testNormMatMatIntMat() {
fail("Not yet implemented");
}
public void testNormalizeMatMatDoubleDoubleInt() {
fail("Not yet implemented");
}
public void testNormalizeMatMatDoubleDouble() {
fail("Not yet implemented");
}
public void testNormalizeMatMatDouble() {
fail("Not yet implemented");
}
public void testNormalizeMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -503,15 +503,11 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testPhaseMatMatMatBoolean() {
fail("Not yet implemented");
}
public void testPhaseMatMatMat() { public void testPhaseMatMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testPolarToCartMatMatMatMatBoolean() { public void testPhaseMatMatMatBoolean() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -519,6 +515,10 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testPolarToCartMatMatMatMatBoolean() {
fail("Not yet implemented");
}
public void testPow() { public void testPow() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -531,11 +531,7 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testRectangleMatPointPointScalarIntIntInt() { public void testRectangleMatPointPointScalar() {
fail("Not yet implemented");
}
public void testRectangleMatPointPointScalarIntInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -543,11 +539,11 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testRectangleMatPointPointScalar() { public void testRectangleMatPointPointScalarIntInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testReduceMatMatIntIntInt() { public void testRectangleMatPointPointScalarIntIntInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -555,6 +551,10 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testReduceMatMatIntIntInt() {
fail("Not yet implemented");
}
public void testRepeat() { public void testRepeat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -563,24 +563,16 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSetIdentityMatScalar() {
fail("Not yet implemented");
}
public void testSetIdentityMat() { public void testSetIdentityMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSetIdentityMatScalar() {
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");
}
public void testSolveMatMatMatInt() {
fail("Not yet implemented");
}
public void testSolveMatMatMat() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -588,7 +580,11 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSolvePolyMatMatInt() { public void testSolveMatMatMat() {
fail("Not yet implemented");
}
public void testSolveMatMatMatInt() {
fail("Not yet implemented"); fail("Not yet implemented");
} }
@ -596,6 +592,10 @@ public class coreTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testSolvePolyMatMatInt() {
fail("Not yet implemented");
}
public void testSort() { public void testSort() {
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");
} }

View File

@ -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,14 +30,6 @@ public class highguiTest extends OpenCVTestCase {
fail("Not yet implemented"); fail("Not yet implemented");
} }
public void testImreadStringInt() {
dst = highgui.imread(LENA, 0);
assertTrue(!dst.empty());
assertEquals(1, dst.channels());
assertTrue(512 == dst.cols());
assertTrue(512 == dst.rows());
}
public void testImreadString() { public void testImreadString() {
dst = highgui.imread(LENA); dst = highgui.imread(LENA);
assertTrue(!dst.empty()); assertTrue(!dst.empty());
@ -55,16 +38,25 @@ public class highguiTest extends OpenCVTestCase {
assertTrue(512 == dst.rows()); assertTrue(512 == dst.rows());
} }
public void testImreadStringInt() {
dst = highgui.imread(LENA, 0);
assertTrue(!dst.empty());
assertEquals(1, dst.channels());
assertTrue(512 == dst.cols());
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,14 +76,14 @@ public class highguiTest extends OpenCVTestCase {
fail("Do not export this function"); fail("Do not export this function");
} }
public void testWaitKeyInt() {
//XXX: we need this function if only imshow will be implemented
fail("Not yet implemented");
}
public void testWaitKey() { 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 testWaitKeyInt() {
//XXX: we need this function if only imshow will be implemented
fail("Not yet implemented");
}
} }

File diff suppressed because it is too large Load Diff

View File

@ -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());
}
}
}

View File

@ -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");
} }