Added several Android tests

This commit is contained in:
Andrey Kamaev 2011-07-27 12:55:43 +00:00
parent 26bd6b3f5f
commit 039fd554f2
4 changed files with 1853 additions and 1740 deletions

View File

@ -8,64 +8,63 @@ import org.opencv.core.Scalar;
import org.opencv.core.Core;
import org.opencv.highgui.Highgui;
public class OpenCVTestCase extends TestCase {
protected static int matSize = 10;
protected static double EPS = 0.001;
protected static Mat dst;
protected static Mat truth;
//Naming notation: <channels info>_[depth]_[dimensions]_value
//examples: gray0 - single channel 8U 2d Mat filled with 0
// grayRnd - single channel 8U 2d Mat filled with random numbers
// gray0_32f_1d
//TODO: OpenCVTestCase refactorings
// - rename matrices
// - create some masks
// - use truth member everywhere
protected static Mat gray0;
protected static Mat gray1;
protected static Mat gray2;
protected static Mat gray3;
protected static Mat gray9;
protected static Mat gray127;
protected static Mat gray128;
protected static Mat gray255;
protected static Mat grayRnd;
protected static Mat gray_16u_256;
protected static Mat gray_16s_1024;
protected static Mat gray0_32f;
protected static Mat gray1_32f;
protected static Mat gray3_32f;
protected static Mat gray9_32f;
protected static Mat gray255_32f;
protected static Mat grayE_32f;
protected static Mat grayRnd_32f;
protected static Mat gray0_32f_1d;
protected static Mat gray0_64f;
protected static Mat gray0_64f_1d;
protected static Mat rgba0;
protected static Mat rgba128;
protected static Mat rgbLena;
protected static Mat grayChess;
protected static Mat v1;
protected static Mat v2;
protected static int matSize = 10;
protected static double EPS = 0.001;
protected static Mat dst;
protected static Mat truth;
// Naming notation: <channels info>_[depth]_[dimensions]_value
// examples: gray0 - single channel 8U 2d Mat filled with 0
// grayRnd - single channel 8U 2d Mat filled with random numbers
// gray0_32f_1d
// TODO: OpenCVTestCase refactorings
// - rename matrices
// - create some masks
// - use truth member everywhere
protected static Mat gray0;
protected static Mat gray1;
protected static Mat gray2;
protected static Mat gray3;
protected static Mat gray9;
protected static Mat gray127;
protected static Mat gray128;
protected static Mat gray255;
protected static Mat grayRnd;
protected static Mat gray_16u_256;
protected static Mat gray_16s_1024;
protected static Mat gray0_32f;
protected static Mat gray1_32f;
protected static Mat gray3_32f;
protected static Mat gray9_32f;
protected static Mat gray255_32f;
protected static Mat grayE_32f;
protected static Mat grayRnd_32f;
protected static Mat gray0_32f_1d;
protected static Mat gray0_64f;
protected static Mat gray0_64f_1d;
protected static Mat rgba0;
protected static Mat rgba128;
protected static Mat rgbLena;
protected static Mat grayChess;
protected static Mat v1;
protected static Mat v2;
@Override
protected void setUp() throws Exception {
super.setUp();
dst = new Mat();
assertTrue(dst.empty());
truth = new Mat();
@ -79,99 +78,102 @@ public class OpenCVTestCase extends TestCase {
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));
Mat low = new Mat(1, 1, CvType.CV_16UC1, new Scalar(0));
gray_16s_1024 = new Mat(matSize, matSize, CvType.CV_16S, new Scalar(
1024));
Mat low = new Mat(1, 1, CvType.CV_16UC1, new Scalar(0));
Mat high = new Mat(1, 1, CvType.CV_16UC1, new Scalar(256));
grayRnd = new Mat(matSize, matSize, CvType.CV_8U); Core.randu(grayRnd, low, high);
grayRnd = new Mat(matSize, matSize, CvType.CV_8U);
Core.randu(grayRnd, low, high);
gray0_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(0.0));
gray1_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(1.0));
gray3_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(3.0));
gray9_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(9.0));
gray255_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(255.0));
grayE_32f = new Mat(matSize, matSize, CvType.CV_32F); grayE_32f = Mat.eye(matSize, matSize, CvType.CV_32FC1);
grayRnd_32f = new Mat(matSize, matSize, CvType.CV_32F); Core.randu(grayRnd_32f, low, high);
gray255_32f = new Mat(matSize, matSize, CvType.CV_32F,
new Scalar(255.0));
grayE_32f = new Mat(matSize, matSize, CvType.CV_32F);
grayE_32f = Mat.eye(matSize, matSize, CvType.CV_32FC1);
grayRnd_32f = new Mat(matSize, matSize, CvType.CV_32F);
Core.randu(grayRnd_32f, low, high);
gray0_32f_1d = new Mat(1, matSize, CvType.CV_32F, new Scalar(0.0));
gray0_64f = new Mat(matSize, matSize, CvType.CV_64F, new Scalar(0.0));
gray0_64f_1d = new Mat(1, matSize, CvType.CV_64F, new Scalar(0.0));
rgba0 = new Mat(matSize, matSize, CvType.CV_8UC4, Scalar.all(0));
rgba128 = new Mat(matSize, matSize, CvType.CV_8UC4, Scalar.all(128));
rgbLena = Highgui.imread(OpenCVTestRunner.LENA_PATH);
grayChess = Highgui.imread(OpenCVTestRunner.CHESS_PATH, 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);
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);
}
public static void assertMatEqual(Mat m1, Mat m2) {
compareMats(m1, m2, true);
compareMats(m1, m2, true);
}
public static void assertMatNotEqual(Mat m1, Mat m2) {
compareMats(m1, m2, false);
compareMats(m1, m2, false);
}
static private void compareMats(Mat m1, Mat m2, boolean isEqualityMeasured) {
//OpenCVTestRunner.Log(m1.toString());
//OpenCVTestRunner.Log(m2.toString());
if (m1.type() != m2.type() ||
m1.cols() != m2.cols() || m1.rows() != m2.rows()) {
throw new UnsupportedOperationException();
}
else if (m1.channels() == 1) {
if (isEqualityMeasured) {
assertTrue(CalcPercentageOfDifference(m1, m2) == 0.0);
}
else {
assertTrue(CalcPercentageOfDifference(m1, m2) != 0.0);
}
}
else {
for (int coi = 0; coi < m1.channels(); coi++) {
Mat m1c = getCOI(m1, coi);
Mat m2c = getCOI(m2, coi);
if (isEqualityMeasured) {
assertTrue(CalcPercentageOfDifference(m1c, m2c) == 0.0);
}
else {
assertTrue(CalcPercentageOfDifference(m1c, m2c) != 0.0);
}
}
}
// OpenCVTestRunner.Log(m1.toString());
// OpenCVTestRunner.Log(m2.toString());
if (m1.type() != m2.type() || m1.cols() != m2.cols()
|| m1.rows() != m2.rows()) {
throw new UnsupportedOperationException();
} else if (m1.channels() == 1) {
if (isEqualityMeasured) {
assertTrue(CalcPercentageOfDifference(m1, m2) == 0.0);
} else {
assertTrue(CalcPercentageOfDifference(m1, m2) != 0.0);
}
} else {
for (int coi = 0; coi < m1.channels(); coi++) {
Mat m1c = getCOI(m1, coi);
Mat m2c = getCOI(m2, coi);
if (isEqualityMeasured) {
assertTrue(CalcPercentageOfDifference(m1c, m2c) == 0.0);
} else {
assertTrue(CalcPercentageOfDifference(m1c, m2c) != 0.0);
}
}
}
}
static private Mat getCOI(Mat m, int coi) {
Mat ch = new Mat(m.rows(), m.cols(), m.depth());
for (int i = 0; i < m.rows(); i++)
for (int j = 0; j < m.cols(); j++)
{
double pixel[] = m.get(i, j);
ch.put(i, j, pixel[coi]);
}
return ch;
Mat ch = new Mat(m.rows(), m.cols(), m.depth());
for (int i = 0; i < m.rows(); i++)
for (int j = 0; j < m.cols(); j++) {
double pixel[] = m.get(i, j);
ch.put(i, j, pixel[coi]);
}
return ch;
}
static private double CalcPercentageOfDifference(Mat m1, Mat m2) {
Mat cmp = new Mat(0, 0, CvType.CV_8U);
Core.compare(m1, m2, cmp, Core.CMP_EQ);
double difference = 100.0 *
(1.0 - Double.valueOf(Core.countNonZero(cmp)) / Double.valueOf(cmp.rows() * cmp.cols()));
double difference = 100.0 * (1.0 - Double.valueOf(Core
.countNonZero(cmp)) / Double.valueOf(cmp.rows() * cmp.cols()));
return difference;
}
public void test_1(String label) {
OpenCVTestRunner.Log("================================================");
OpenCVTestRunner.Log("=============== " + label);
OpenCVTestRunner
.Log("================================================");
OpenCVTestRunner.Log("=============== " + label);
}
}

View File

@ -10,363 +10,418 @@ import org.opencv.core.Core;
import org.opencv.test.OpenCVTestCase;
public class calib3dTest extends OpenCVTestCase {
public void test_1() {
super.test_1("calib3d");
}
public void testCalibrateCameraListOfMatListOfMatSizeMatMatListOfMatListOfMat() {
fail("Not yet implemented");
}
public void testCalibrateCameraListOfMatListOfMatSizeMatMatListOfMatListOfMatInt() {
fail("Not yet implemented");
}
public void testCalibrationMatrixValues() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMat() {
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 rvec3 = new Mat();
Mat tvec3 = new Mat();
Mat outRvec = new Mat(3, 1, CvType.CV_32F); outRvec.put(0, 0, 1.418641, 0.88665926, 0.56020796);
Mat outTvec = new Mat(3, 1, CvType.CV_32F); outTvec.put(0, 0, 1.4560841, 1.0680628, 0.81598103);
Calib3d.composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3);
assertMatEqual(outRvec, rvec3);
assertMatEqual(outTvec, tvec3);
}
public void testComposeRTMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMatMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
// Mat dr3dr1;
// Mat dr3dt1;
// Mat dr3dr2;
// Mat dr3dt2;
// Mat dt3dr1;
// Mat dt3dt1;
// Mat dt3dr2;
// Mat dt3dt2;
//, dr3dr1, dr3dt1, dr3dr2, dr3dt2, dt3dr1, dt3dt1, dt3dr2, dt3dt2);
// [0.97031879, -0.091774099, 0.38594806;
// 0.15181915, 0.98091727, -0.44186208;
// -0.39509675, 0.43839464, 0.93872648]
// [0, 0, 0;
// 0, 0, 0;
// 0, 0, 0]
// [1.0117353, 0.16348237, -0.083180845;
// -0.1980398, 1.006078, 0.30299222;
// 0.075766489, -0.32784501, 1.0163091]
// [0, 0, 0;
// 0, 0, 0;
// 0, 0, 0]
// [0, 0, 0;
// 0, 0, 0;
// 0, 0, 0]
// [0.69658804, 0.018115902, 0.7172426;
// 0.51114357, 0.68899536, -0.51382649;
// -0.50348526, 0.72453934, 0.47068608]
// [0.18536358, -0.20515044, -0.48834875;
// -0.25120571, 0.29043972, 0.60573936;
// 0.35370794, -0.69923931, 0.45781645]
// [1, 0, 0;
// 0, 1, 0;
// 0, 0, 1]
}
public void testConvertPointsFromHomogeneous() {
fail("Not yet implemented");
}
public void testConvertPointsToHomogeneous() {
fail("Not yet implemented");
}
public void testDecomposeProjectionMatrixMatMatMatMat() {
fail("Not yet implemented");
}
public void testDecomposeProjectionMatrixMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testDecomposeProjectionMatrixMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testDecomposeProjectionMatrixMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testDecomposeProjectionMatrixMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testDrawChessboardCorners() {
fail("Not yet implemented");
}
public void testEstimateAffine3DMatMatMatMat() {
fail("Not yet implemented");
}
public void testEstimateAffine3DMatMatMatMatDouble() {
fail("Not yet implemented");
}
public void testEstimateAffine3DMatMatMatMatDoubleDouble() {
fail("Not yet implemented");
}
public void testFilterSpecklesMatDoubleIntDouble() {
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);
}
public void testFilterSpecklesMatDoubleIntDoubleMat() {
fail("Not yet implemented");
}
public void testFindChessboardCornersMatSizeMat() {
Size patternSize = new Size(9, 6);
Calib3d.findChessboardCorners(grayChess, patternSize, dst);
assertTrue(!dst.empty());
}
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);
assertTrue(!dst.empty());
}
public void testFindCirclesGridDefaultMatSizeMat() {
fail("Not yet implemented");
}
public void testFindCirclesGridDefaultMatSizeMatInt() {
fail("Not yet implemented");
}
public void testFindFundamentalMatMatMat() {
fail("Not yet implemented");
}
public void testFindFundamentalMatMatMatInt() {
fail("Not yet implemented");
}
public void testFindFundamentalMatMatMatIntDouble() {
fail("Not yet implemented");
}
public void testFindFundamentalMatMatMatIntDoubleDouble() {
fail("Not yet implemented");
}
public void testFindFundamentalMatMatMatIntDoubleDoubleMat() {
fail("Not yet implemented");
}
public void testFindHomographyMatMat() {
fail("Not yet implemented");
}
public void testFindHomographyMatMatInt() {
fail("Not yet implemented");
}
public void testFindHomographyMatMatIntDouble() {
fail("Not yet implemented");
}
public void testFindHomographyMatMatIntDoubleMat() {
fail("Not yet implemented");
}
public void testGetOptimalNewCameraMatrixMatMatSizeDouble() {
fail("Not yet implemented");
}
public void testGetOptimalNewCameraMatrixMatMatSizeDoubleSize() {
fail("Not yet implemented");
}
public void testGetOptimalNewCameraMatrixMatMatSizeDoubleSizeRect() {
fail("Not yet implemented");
}
public void testGetOptimalNewCameraMatrixMatMatSizeDoubleSizeRectBoolean() {
fail("Not yet implemented");
}
public void testGetValidDisparityROI() {
fail("Not yet implemented");
}
public void testInitCameraMatrix2DListOfMatListOfMatSize() {
fail("Not yet implemented");
}
public void testInitCameraMatrix2DListOfMatListOfMatSizeDouble() {
fail("Not yet implemented");
}
public void testMatMulDeriv() {
fail("Not yet implemented");
}
public void testProjectPointsMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testProjectPointsMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testProjectPointsMatMatMatMatMatMatMatDouble() {
fail("Not yet implemented");
}
public void testRectify3Collinear() {
fail("Not yet implemented");
}
public void testReprojectImageTo3DMatMatMat() {
fail("Not yet implemented");
}
public void testReprojectImageTo3DMatMatMatBoolean() {
fail("Not yet implemented");
}
public void testReprojectImageTo3DMatMatMatBooleanInt() {
fail("Not yet implemented");
}
public void test_1() {
super.test_1("calib3d");
}
public void testCalibrateCameraListOfMatListOfMatSizeMatMatListOfMatListOfMat() {
fail("Not yet implemented");
}
public void testCalibrateCameraListOfMatListOfMatSizeMatMatListOfMatListOfMatInt() {
fail("Not yet implemented");
}
public void testCalibrationMatrixValues() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMat() {
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 rvec3 = new Mat();
Mat tvec3 = new Mat();
Mat outRvec = new Mat(3, 1, CvType.CV_32F);
outRvec.put(0, 0, 1.418641, 0.88665926, 0.56020796);
Mat outTvec = new Mat(3, 1, CvType.CV_32F);
outTvec.put(0, 0, 1.4560841, 1.0680628, 0.81598103);
Calib3d.composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3);
assertMatEqual(outRvec, rvec3);
assertMatEqual(outTvec, tvec3);
}
public void testComposeRTMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testComposeRTMatMatMatMatMatMatMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
// Mat dr3dr1;
// Mat dr3dt1;
// Mat dr3dr2;
// Mat dr3dt2;
// Mat dt3dr1;
// Mat dt3dt1;
// Mat dt3dr2;
// Mat dt3dt2;
// , dr3dr1, dr3dt1, dr3dr2, dr3dt2, dt3dr1, dt3dt1, dt3dr2, dt3dt2);
// [0.97031879, -0.091774099, 0.38594806;
// 0.15181915, 0.98091727, -0.44186208;
// -0.39509675, 0.43839464, 0.93872648]
// [0, 0, 0;
// 0, 0, 0;
// 0, 0, 0]
// [1.0117353, 0.16348237, -0.083180845;
// -0.1980398, 1.006078, 0.30299222;
// 0.075766489, -0.32784501, 1.0163091]
// [0, 0, 0;
// 0, 0, 0;
// 0, 0, 0]
// [0, 0, 0;
// 0, 0, 0;
// 0, 0, 0]
// [0.69658804, 0.018115902, 0.7172426;
// 0.51114357, 0.68899536, -0.51382649;
// -0.50348526, 0.72453934, 0.47068608]
// [0.18536358, -0.20515044, -0.48834875;
// -0.25120571, 0.29043972, 0.60573936;
// 0.35370794, -0.69923931, 0.45781645]
// [1, 0, 0;
// 0, 1, 0;
// 0, 0, 1]
}
public void testConvertPointsFromHomogeneous() {
fail("Not yet implemented");
}
public void testConvertPointsToHomogeneous() {
fail("Not yet implemented");
}
public void testDecomposeProjectionMatrixMatMatMatMat() {
fail("Not yet implemented");
}
public void testDecomposeProjectionMatrixMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testDecomposeProjectionMatrixMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testDecomposeProjectionMatrixMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testDecomposeProjectionMatrixMatMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testDrawChessboardCorners() {
fail("Not yet implemented");
}
public void testEstimateAffine3DMatMatMatMat() {
fail("Not yet implemented");
}
public void testEstimateAffine3DMatMatMatMatDouble() {
fail("Not yet implemented");
}
public void testEstimateAffine3DMatMatMatMatDoubleDouble() {
fail("Not yet implemented");
}
public void testFilterSpecklesMatDoubleIntDouble() {
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);
}
public void testFilterSpecklesMatDoubleIntDoubleMat() {
fail("Not yet implemented");
}
public void testFindChessboardCornersMatSizeMat() {
Size patternSize = new Size(9, 6);
Calib3d.findChessboardCorners(grayChess, patternSize, dst);
assertTrue(!dst.empty());
}
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);
assertTrue(!dst.empty());
}
public void testFindCirclesGridDefaultMatSizeMat() {
int size = 300;
Mat img = new Mat(size, size, CvType.CV_8U);
img.setTo(new Scalar(255));
Mat centers = new Mat();
assertFalse(Calib3d
.findCirclesGridDefault(img, new Size(5, 5), centers));
for (int i = 0; i < 5; i++)
for (int j = 0; j < 5; j++) {
Point pt = new Point(size * (2 * i + 1) / 10, size
* (2 * j + 1) / 10);
Core.circle(img, pt, 10, new Scalar(0), -1);
}
org.opencv.highgui.Highgui.imwrite("/mnt/sdcard/test3.png", img);
assertTrue(Calib3d.findCirclesGridDefault(img, new Size(5, 5), centers));
assertEquals(25, centers.rows());
assertEquals(1, centers.cols());
assertEquals(CvType.CV_32FC2, centers.type());
}
public void testFindCirclesGridDefaultMatSizeMatInt() {
int size = 300;
Mat img = new Mat(size, size, CvType.CV_8U);
img.setTo(new Scalar(255));
Mat centers = new Mat();
assertFalse(Calib3d.findCirclesGridDefault(img, new Size(3, 5),
centers, Calib3d.CALIB_CB_CLUSTERING
| Calib3d.CALIB_CB_ASYMMETRIC_GRID));
int step = size * 2 / 15;
int offsetx = size / 6;
int offsety = (size - 4 * step) / 2;
for (int i = 0; i < 3; i++)
for (int j = 0; j < 5; j++) {
Point pt = new Point(offsetx + (2 * i + j % 2) * step, offsety
+ step * j);
Core.circle(img, pt, 10, new Scalar(0), -1);
}
assertTrue(Calib3d.findCirclesGridDefault(img, new Size(3, 5), centers,
Calib3d.CALIB_CB_CLUSTERING | Calib3d.CALIB_CB_ASYMMETRIC_GRID));
assertEquals(15, centers.rows());
assertEquals(1, centers.cols());
assertEquals(CvType.CV_32FC2, centers.type());
}
public void testFindFundamentalMatMatMat() {
fail("Not yet implemented");
}
public void testFindFundamentalMatMatMatInt() {
fail("Not yet implemented");
}
public void testFindFundamentalMatMatMatIntDouble() {
fail("Not yet implemented");
}
public void testFindFundamentalMatMatMatIntDoubleDouble() {
fail("Not yet implemented");
}
public void testFindFundamentalMatMatMatIntDoubleDoubleMat() {
fail("Not yet implemented");
}
public void testFindHomographyMatMat() {
fail("Not yet implemented");
}
public void testFindHomographyMatMatInt() {
fail("Not yet implemented");
}
public void testFindHomographyMatMatIntDouble() {
fail("Not yet implemented");
}
public void testFindHomographyMatMatIntDoubleMat() {
fail("Not yet implemented");
}
public void testGetOptimalNewCameraMatrixMatMatSizeDouble() {
fail("Not yet implemented");
}
public void testGetOptimalNewCameraMatrixMatMatSizeDoubleSize() {
fail("Not yet implemented");
}
public void testGetOptimalNewCameraMatrixMatMatSizeDoubleSizeRect() {
fail("Not yet implemented");
}
public void testGetOptimalNewCameraMatrixMatMatSizeDoubleSizeRectBoolean() {
fail("Not yet implemented");
}
public void testGetValidDisparityROI() {
fail("Not yet implemented");
}
public void testInitCameraMatrix2DListOfMatListOfMatSize() {
fail("Not yet implemented");
}
public void testInitCameraMatrix2DListOfMatListOfMatSizeDouble() {
fail("Not yet implemented");
}
public void testMatMulDeriv() {
fail("Not yet implemented");
}
public void testProjectPointsMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testProjectPointsMatMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testProjectPointsMatMatMatMatMatMatMatDouble() {
fail("Not yet implemented");
}
public void testRectify3Collinear() {
fail("Not yet implemented");
}
public void testReprojectImageTo3DMatMatMat() {
fail("Not yet implemented");
}
public void testReprojectImageTo3DMatMatMatBoolean() {
fail("Not yet implemented");
}
public void testReprojectImageTo3DMatMatMatBooleanInt() {
fail("Not yet implemented");
}
public void testRodriguesMatMat() {
fail("Not yet implemented");
}
public void testRodriguesMatMat() {
fail("Not yet implemented");
}
public void testRodriguesMatMatMat() {
fail("Not yet implemented");
}
public void testRodriguesMatMatMat() {
fail("Not yet implemented");
}
public void testRQDecomp3x3MatMatMat() {
fail("Not yet implemented");
}
public void testRQDecomp3x3MatMatMat() {
fail("Not yet implemented");
}
public void testRQDecomp3x3MatMatMatMat() {
fail("Not yet implemented");
}
public void testRQDecomp3x3MatMatMatMat() {
fail("Not yet implemented");
}
public void testRQDecomp3x3MatMatMatMatMat() {
fail("Not yet implemented");
}
public void testRQDecomp3x3MatMatMatMatMat() {
fail("Not yet implemented");
}
public void testRQDecomp3x3MatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testRQDecomp3x3MatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testSolvePnPMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testSolvePnPMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testSolvePnPMatMatMatMatMatMatBoolean() {
fail("Not yet implemented");
}
public void testSolvePnPMatMatMatMatMatMatBoolean() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMat() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMatBoolean() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMatBoolean() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMatBooleanInt() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMatBooleanInt() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloat() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloat() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloatInt() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloatInt() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloatIntMat() {
fail("Not yet implemented");
}
public void testSolvePnPRansacMatMatMatMatMatMatBooleanIntFloatIntMat() {
fail("Not yet implemented");
}
public void testStereoCalibrateListOfMatListOfMatListOfMatMatMatMatMatSizeMatMatMatMat() {
fail("Not yet implemented");
}
public void testStereoCalibrateListOfMatListOfMatListOfMatMatMatMatMatSizeMatMatMatMat() {
fail("Not yet implemented");
}
public void testStereoCalibrateListOfMatListOfMatListOfMatMatMatMatMatSizeMatMatMatMatTermCriteria() {
fail("Not yet implemented");
}
public void testStereoCalibrateListOfMatListOfMatListOfMatMatMatMatMatSizeMatMatMatMatTermCriteria() {
fail("Not yet implemented");
}
public void testStereoCalibrateListOfMatListOfMatListOfMatMatMatMatMatSizeMatMatMatMatTermCriteriaInt() {
fail("Not yet implemented");
}
public void testStereoCalibrateListOfMatListOfMatListOfMatMatMatMatMatSizeMatMatMatMatTermCriteriaInt() {
fail("Not yet implemented");
}
public void testStereoRectifyUncalibratedMatMatMatSizeMatMat() {
fail("Not yet implemented");
}
public void testStereoRectifyUncalibratedMatMatMatSizeMatMat() {
fail("Not yet implemented");
}
public void testStereoRectifyUncalibratedMatMatMatSizeMatMatDouble() {
fail("Not yet implemented");
}
public void testStereoRectifyUncalibratedMatMatMatSizeMatMatDouble() {
fail("Not yet implemented");
}
public void testValidateDisparityMatMatIntInt() {
fail("Not yet implemented");
}
public void testValidateDisparityMatMatIntInt() {
fail("Not yet implemented");
}
public void testValidateDisparityMatMatIntIntInt() {
fail("Not yet implemented");
}
public void testValidateDisparityMatMatIntIntInt() {
fail("Not yet implemented");
}
}

View File

@ -1,5 +1,7 @@
package org.opencv.test.core;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.test.OpenCVTestCase;
public class RectTest extends OpenCVTestCase {
@ -21,7 +23,21 @@ public class RectTest extends OpenCVTestCase {
}
public void testContains() {
fail("Not yet implemented");
Rect r = new Rect(0,0,10,10);
Point p_inner = new Point(5,5);
Point p_outer = new Point(5,55);
Point p_bl = new Point(0,0);
Point p_br = new Point(10,0);
Point p_tl = new Point(0,10);
Point p_tr = new Point(10,10);
assertTrue(r.contains(p_inner));
assertTrue(r.contains(p_bl));
assertFalse(r.contains(p_outer));
assertFalse(r.contains(p_br));
assertFalse(r.contains(p_tl));
assertFalse(r.contains(p_tr));
}
public void testEqualsObject() {