java tests: added a chessboard image
This commit is contained in:
parent
7ca50b2b3d
commit
63f8feb2a1
BIN
modules/java/android_test/res/drawable/chessboard.jpg
Normal file
BIN
modules/java/android_test/res/drawable/chessboard.jpg
Normal file
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 rgba128;
|
||||||
|
|
||||||
protected static Mat rgbLena;
|
protected static Mat rgbLena;
|
||||||
|
protected static Mat grayChess;
|
||||||
|
|
||||||
protected static Mat v1;
|
protected static Mat v1;
|
||||||
protected static Mat v2;
|
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));
|
rgba128 = new Mat(matSize, matSize, CvType.CV_8UC4); rgba128.setTo(Scalar.all(128));
|
||||||
|
|
||||||
rgbLena = highgui.imread(OpenCVTestRunner.LENA_PATH);
|
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);
|
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);
|
v2 = new Mat(1, 3, CvType.CV_32F); v2.put(0, 0, 2.0, 1.0, 3.0);
|
||||||
|
@ -20,9 +20,10 @@ import android.util.Log;
|
|||||||
public class OpenCVTestRunner extends InstrumentationTestRunner {
|
public class OpenCVTestRunner extends InstrumentationTestRunner {
|
||||||
|
|
||||||
public static String LENA_PATH = "/data/data/org.opencv.test/files/lena.jpg";
|
public static String LENA_PATH = "/data/data/org.opencv.test/files/lena.jpg";
|
||||||
|
public static String CHESS_PATH = "/data/data/org.opencv.test/files/chessboard.jpg";
|
||||||
|
private static String TAG = "opencv_test_java";
|
||||||
|
|
||||||
private AndroidTestRunner androidTestRunner;
|
private AndroidTestRunner androidTestRunner;
|
||||||
private static String TAG = "opencv_test_java";
|
|
||||||
|
|
||||||
static public void Log(String message) {
|
static public void Log(String message) {
|
||||||
Log.e(TAG, message);
|
Log.e(TAG, message);
|
||||||
@ -30,7 +31,8 @@ public class OpenCVTestRunner extends InstrumentationTestRunner {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
ExportLena();
|
ExportResourceImage("lena.jpg", R.drawable.lena);
|
||||||
|
ExportResourceImage("chessboard.jpg", R.drawable.chessboard);
|
||||||
|
|
||||||
//List<TestCase> testCases = androidTestRunner.getTestCases();
|
//List<TestCase> testCases = androidTestRunner.getTestCases();
|
||||||
//Collections.shuffle(testCases); //shuffle the tests order
|
//Collections.shuffle(testCases); //shuffle the tests order
|
||||||
@ -44,16 +46,16 @@ public class OpenCVTestRunner extends InstrumentationTestRunner {
|
|||||||
return androidTestRunner;
|
return androidTestRunner;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExportLena() {
|
private void ExportResourceImage(String image, int rId) {
|
||||||
try {
|
try {
|
||||||
Bitmap mBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.drawable.lena);
|
Bitmap mBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), rId);
|
||||||
FileOutputStream fos = this.getContext().openFileOutput("lena.jpg", Context.MODE_WORLD_READABLE);
|
FileOutputStream fos = this.getContext().openFileOutput(image, Context.MODE_WORLD_READABLE);
|
||||||
mBitmap.compress(CompressFormat.JPEG, 100, fos);
|
mBitmap.compress(CompressFormat.JPEG, 100, fos);
|
||||||
fos.flush();
|
fos.flush();
|
||||||
fos.close();
|
fos.close();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
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;
|
package org.opencv.test.calib3d;
|
||||||
|
|
||||||
|
import org.opencv.Size;
|
||||||
|
import org.opencv.calib3d;
|
||||||
import org.opencv.test.OpenCVTestCase;
|
import org.opencv.test.OpenCVTestCase;
|
||||||
|
import org.opencv.test.OpenCVTestRunner;
|
||||||
|
|
||||||
public class calib3dTest extends OpenCVTestCase {
|
public class calib3dTest extends OpenCVTestCase {
|
||||||
|
|
||||||
@ -93,11 +96,13 @@ public class calib3dTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testFindChessboardCornersMatSizeMat() {
|
public void testFindChessboardCornersMatSizeMat() {
|
||||||
fail("Not yet implemented");
|
Size patternSize = new Size(9, 6);
|
||||||
|
calib3d.findChessboardCorners(grayChess, patternSize, dst);
|
||||||
|
assertTrue(!dst.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFindChessboardCornersMatSizeMatInt() {
|
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() {
|
public void testFindFundamentalMatMatMat() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user