java tests: split test, minor improvements

This commit is contained in:
Kirill Kornyakov 2011-07-18 16:41:17 +00:00
parent 1badec0b2d
commit 39ec7099e2
4 changed files with 24 additions and 30 deletions

View File

@ -65,14 +65,14 @@ public class OpenCVTestCase extends TestCase {
dst = new Mat();
assertTrue(dst.empty());
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));
gray0 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(0));
gray1 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(1));
gray2 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(2));
gray3 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(3));
gray9 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(9));
gray127 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(127));
gray128 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(128));
gray255 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255));
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));

View File

@ -34,6 +34,8 @@ public class OpenCVTestRunner extends InstrumentationTestRunner {
public void onStart() {
ExportResourceImage("lena.jpg", R.drawable.lena);
ExportResourceImage("chessboard.jpg", R.drawable.chessboard);
//FIXME: implement export of the cascade
//List<TestCase> testCases = androidTestRunner.getTestCases();
//Collections.shuffle(testCases); //shuffle the tests order

View File

@ -16,10 +16,10 @@ public class calib3dTest extends OpenCVTestCase {
}
public void testComposeRTMatMatMatMatMatMat() {
Mat rvec1 = new Mat(3, 1, CvType.CV_32F); rvec1.put(0, 0, 0.5302828, 0.19925919, 0.40105945);
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 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();
@ -143,10 +143,10 @@ public class calib3dTest extends OpenCVTestCase {
}
public void testFilterSpecklesMatDoubleIntDouble() {
gray_16s_1024.copyTo(dst);
Point center = new Point(gray_16s_1024.rows()/2., gray_16s_1024.cols()/2.);
gray_16s_1024.copyTo(dst);
Point center = new Point(gray_16s_1024.rows()/2., gray_16s_1024.cols()/2.);
core.circle(dst, center, 1, Scalar.all(4096));
assertMatNotEqual(gray_16s_1024, dst);
calib3d.filterSpeckles(dst, 1024.0, 100, 0.);
assertMatEqual(gray_16s_1024, dst);
@ -165,7 +165,7 @@ 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.CALIB_CB_ADAPTIVE_THRESH + calib3d.CALIB_CB_NORMALIZE_IMAGE + calib3d.CALIB_CB_FAST_CHECK);
assertTrue(!dst.empty());
}

View File

@ -9,7 +9,6 @@ import org.opencv.Rect;
import org.opencv.Scalar;
import org.opencv.core;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
public class coreTest extends OpenCVTestCase {
@ -311,12 +310,12 @@ public class coreTest extends OpenCVTestCase {
Mat out2 = new Mat(1, 4, CvType.CV_32F);
src.put(0, 0, 1, 2, 3, 4);
out.put(0 , 0, 10, -2, 2, -2);
out.put(0, 0, 10, -2, 2, -2);
core.dft(src, dst, core.DFT_REAL_OUTPUT);
assertMatEqual(out, dst);
core.dft(src, dst, core.DFT_INVERSE);
out2.put(0 , 0, 9, -9, 1, 3);
out2.put(0, 0, 9, -9, 1, 3);
assertMatEqual(out2, dst);
}
@ -325,7 +324,7 @@ public class coreTest extends OpenCVTestCase {
Mat out = new Mat(1, 4, CvType.CV_32F);
src.put(0, 0, 1, 2, 3, 4);
out.put(0 , 0, 10, -2, 2, -2);
out.put(0, 0, 10, -2, 2, -2);
core.dft(src, dst, core.DFT_REAL_OUTPUT, 1);
assertMatEqual(out, dst);
}
@ -1244,14 +1243,11 @@ public class coreTest extends OpenCVTestCase {
}
public void testSplit() {
fail("Not yet implemented");
//FIXME: must work
//ArrayList<Mat> cois = new ArrayList<Mat>();
//core.split(rgba0, cois);
// for(Mat coi : cois) {
// OpenCVTestRunner.Log(coi.toString());
// //assertMatEqual(gray0, coi);
// }
ArrayList<Mat> cois = new ArrayList<Mat>();
core.split(rgba0, cois);
for(Mat coi : cois) {
assertMatEqual(gray0, coi);
}
}
public void testSqrt() {
@ -1314,8 +1310,4 @@ public class coreTest extends OpenCVTestCase {
assertTrue(subdst.total() == core.countNonZero(subdst));
}
public void testVconcat() {
fail("Not yet implemented");
}
}