java tests: added a chessboard image

pull/13383/head
Kirill Kornyakov 14 years ago
parent 7ca50b2b3d
commit 63f8feb2a1
  1. BIN
      modules/java/android_test/res/drawable/chessboard.jpg
  2. 2
      modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
  3. 16
      modules/java/android_test/src/org/opencv/test/OpenCVTestRunner.java
  4. 9
      modules/java/android_test/src/org/opencv/test/calib3d/calib3dTest.java

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

@ -49,6 +49,7 @@ public class OpenCVTestCase extends TestCase {
protected static Mat rgba128;
protected static Mat rgbLena;
protected static Mat grayChess;
protected static Mat v1;
protected static Mat v2;
@ -92,6 +93,7 @@ public class OpenCVTestCase extends TestCase {
rgba128 = new Mat(matSize, matSize, CvType.CV_8UC4); rgba128.setTo(Scalar.all(128));
rgbLena = highgui.imread(OpenCVTestRunner.LENA_PATH);
grayChess = highgui.imread(OpenCVTestRunner.CHESS_PATH);
v1 = new Mat(1, 3, CvType.CV_32F); v1.put(0, 0, 1.0, 3.0, 2.0);
v2 = new Mat(1, 3, CvType.CV_32F); v2.put(0, 0, 2.0, 1.0, 3.0);

@ -20,17 +20,19 @@ import android.util.Log;
public class OpenCVTestRunner extends InstrumentationTestRunner {
public static String LENA_PATH = "/data/data/org.opencv.test/files/lena.jpg";
private AndroidTestRunner androidTestRunner;
public static String CHESS_PATH = "/data/data/org.opencv.test/files/chessboard.jpg";
private static String TAG = "opencv_test_java";
private AndroidTestRunner androidTestRunner;
static public void Log(String message) {
Log.e(TAG, message);
}
@Override
public void onStart() {
ExportLena();
ExportResourceImage("lena.jpg", R.drawable.lena);
ExportResourceImage("chessboard.jpg", R.drawable.chessboard);
//List<TestCase> testCases = androidTestRunner.getTestCases();
//Collections.shuffle(testCases); //shuffle the tests order
@ -44,16 +46,16 @@ public class OpenCVTestRunner extends InstrumentationTestRunner {
return androidTestRunner;
}
private void ExportLena() {
private void ExportResourceImage(String image, int rId) {
try {
Bitmap mBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.drawable.lena);
FileOutputStream fos = this.getContext().openFileOutput("lena.jpg", Context.MODE_WORLD_READABLE);
Bitmap mBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), rId);
FileOutputStream fos = this.getContext().openFileOutput(image, Context.MODE_WORLD_READABLE);
mBitmap.compress(CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
}
catch (Exception e) {
Log("Tried to write lena.jpg, but: " + e.toString());
Log("Tried to write " + image + ", but: " + e.toString());
}
}
}

@ -1,6 +1,9 @@
package org.opencv.test.calib3d;
import org.opencv.Size;
import org.opencv.calib3d;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
public class calib3dTest extends OpenCVTestCase {
@ -93,11 +96,13 @@ public class calib3dTest extends OpenCVTestCase {
}
public void testFindChessboardCornersMatSizeMat() {
fail("Not yet implemented");
Size patternSize = new Size(9, 6);
calib3d.findChessboardCorners(grayChess, patternSize, dst);
assertTrue(!dst.empty());
}
public void testFindChessboardCornersMatSizeMatInt() {
fail("Not yet implemented");
fail("Not yet implemented");//CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE + CALIB_CB_FAST_CHECK
}
public void testFindFundamentalMatMatMat() {

Loading…
Cancel
Save