Commit da64ba1b authored by Kirill Kornyakov's avatar Kirill Kornyakov

java tests: found a reason of crash (addWeighted bug #1224), some tests cleaned and added

parent 2dea07f9
...@@ -12,6 +12,7 @@ import org.opencv.highgui; ...@@ -12,6 +12,7 @@ import org.opencv.highgui;
public class OpenCVTestCase extends TestCase { public class OpenCVTestCase extends TestCase {
protected static int matSize = 10; protected static int matSize = 10;
protected static double EPS = 0.001;
protected static Mat dst; protected static Mat dst;
...@@ -62,37 +63,37 @@ public class OpenCVTestCase extends TestCase { ...@@ -62,37 +63,37 @@ public class OpenCVTestCase extends TestCase {
dst = new Mat(); dst = new Mat();
assertTrue(dst.empty()); assertTrue(dst.empty());
gray0 = new Mat(matSize, matSize, CvType.CV_8U); gray0.setTo(new Scalar(0.0)); gray0 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(0.0));
gray1 = new Mat(matSize, matSize, CvType.CV_8U); gray1.setTo(new Scalar(1.0)); gray1 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(1.0));
gray2 = new Mat(matSize, matSize, CvType.CV_8U); gray2.setTo(new Scalar(2.0)); gray2 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(2.0));
gray3 = new Mat(matSize, matSize, CvType.CV_8U); gray3.setTo(new Scalar(3.0)); gray3 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(3.0));
gray9 = new Mat(matSize, matSize, CvType.CV_8U); gray9.setTo(new Scalar(9.0)); gray9 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(9.0));
gray127 = new Mat(matSize, matSize, CvType.CV_8U); gray127.setTo(new Scalar(127.0)); gray127 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(127.0));
gray128 = new Mat(matSize, matSize, CvType.CV_8U); gray128.setTo(new Scalar(128.0)); gray128 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(128.0));
gray255 = new Mat(matSize, matSize, CvType.CV_8U); gray255.setTo(new Scalar(255.0)); gray255 = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(255.0));
gray_16u_256 = new Mat(matSize, matSize, CvType.CV_16U); gray_16u_256.setTo(new Scalar(256)); gray_16u_256 = new Mat(matSize, matSize, CvType.CV_16U, new Scalar(256));
gray_16s_1024 = new Mat(matSize, matSize, CvType.CV_16S); gray_16s_1024.setTo(new Scalar(1024)); 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 low = new Mat(1, 1, CvType.CV_16UC1, new Scalar(0));
Mat high = new Mat(1, 1, CvType.CV_16UC1, new Scalar(256)); 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); gray0_32f.setTo(new Scalar(0.0)); gray0_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(0.0));
gray1_32f = new Mat(matSize, matSize, CvType.CV_32F); gray1_32f.setTo(new Scalar(1.0)); gray1_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(1.0));
gray3_32f = new Mat(matSize, matSize, CvType.CV_32F); gray3_32f.setTo(new Scalar(3.0)); gray3_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(3.0));
gray9_32f = new Mat(matSize, matSize, CvType.CV_32F); gray9_32f.setTo(new Scalar(9.0)); gray9_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(9.0));
gray255_32f = new Mat(matSize, matSize, CvType.CV_32F); gray255_32f.setTo(new Scalar(255.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); 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); 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); gray0_32f_1d.setTo(new Scalar(0.0)); gray0_32f_1d = new Mat(1, matSize, CvType.CV_32F, new Scalar(0.0));
gray0_64f = new Mat(matSize, matSize, CvType.CV_64F); gray0_64f.setTo(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); gray0_64f_1d.setTo(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); rgba0.setTo(Scalar.all(0)); rgba0 = new Mat(matSize, matSize, CvType.CV_8UC4, Scalar.all(0));
rgba128 = new Mat(matSize, matSize, CvType.CV_8UC4); rgba128.setTo(Scalar.all(128)); rgba128 = new Mat(matSize, matSize, CvType.CV_8UC4, Scalar.all(128));
rgbLena = highgui.imread(OpenCVTestRunner.LENA_PATH); rgbLena = highgui.imread(OpenCVTestRunner.LENA_PATH);
grayChess = highgui.imread(OpenCVTestRunner.CHESS_PATH); grayChess = highgui.imread(OpenCVTestRunner.CHESS_PATH);
......
package org.opencv.test.calib3d; package org.opencv.test.calib3d;
import org.opencv.CvType;
import org.opencv.Mat;
import org.opencv.Point; import org.opencv.Point;
import org.opencv.Scalar; import org.opencv.Scalar;
import org.opencv.Size; import org.opencv.Size;
...@@ -8,9 +10,27 @@ import org.opencv.core; ...@@ -8,9 +10,27 @@ import org.opencv.core;
import org.opencv.test.OpenCVTestCase; import org.opencv.test.OpenCVTestCase;
public class calib3dTest extends OpenCVTestCase { public class calib3dTest extends OpenCVTestCase {
public void test_1() {
super.test_1("calib3d");
}
public void testComposeRTMatMatMatMatMatMat() { public void testComposeRTMatMatMatMatMatMat() {
fail("Not yet implemented"); 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() { public void testComposeRTMatMatMatMatMatMatMat() {
...@@ -43,6 +63,39 @@ public class calib3dTest extends OpenCVTestCase { ...@@ -43,6 +63,39 @@ public class calib3dTest extends OpenCVTestCase {
public void testComposeRTMatMatMatMatMatMatMatMatMatMatMatMatMatMat() { public void testComposeRTMatMatMatMatMatMatMatMatMatMatMatMatMatMat() {
fail("Not yet implemented"); 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() { public void testConvertPointsFromHomogeneous() {
...@@ -111,8 +164,8 @@ public class calib3dTest extends OpenCVTestCase { ...@@ -111,8 +164,8 @@ public class calib3dTest extends OpenCVTestCase {
public void testFindChessboardCornersMatSizeMatInt() { public void testFindChessboardCornersMatSizeMatInt() {
Size patternSize = new Size(9, 6); Size patternSize = new Size(9, 6);
calib3d.findChessboardCorners(grayChess, patternSize, dst, calib3d.CALIB_CB_ADAPTIVE_THRESH calib3d.findChessboardCorners(grayChess, patternSize, dst,
+ 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()); assertTrue(!dst.empty());
} }
......
package org.opencv.test.core;
import org.opencv.core.FileStorage;
import org.opencv.test.OpenCVTestCase;
public class FileStorageTest extends OpenCVTestCase {
private FileStorage fs;
@Override
protected void setUp() throws Exception {
super.setUp();
fs = null;
}
public void test_1() {
super.test_1("CORE.FileStorage");
}
public void testFileStorage() {
fs = new FileStorage();
assertTrue(null != fs);
}
public void testFileStorageLong() {
fail("Not yet implemented");
}
public void testFileStorageStringInt() {
fs = new FileStorage("test.yml", FileStorage.WRITE);
assertTrue(null != fs);
}
public void testFileStorageStringIntString() {
fail("Not yet implemented");
}
public void testIsOpened() {
fs = new FileStorage();
assertFalse(fs.isOpened());
fs = new FileStorage("test.yml", FileStorage.WRITE);
assertTrue(fs.isOpened());
}
public void testOpenStringInt() {
fail("Not yet implemented");
}
public void testOpenStringIntString() {
fail("Not yet implemented");
}
public void testRelease() {
fail("Not yet implemented");
}
}
...@@ -5,141 +5,127 @@ import org.opencv.Rect; ...@@ -5,141 +5,127 @@ import org.opencv.Rect;
import org.opencv.RotatedRect; import org.opencv.RotatedRect;
import org.opencv.Size; import org.opencv.Size;
import org.opencv.test.OpenCVTestCase; import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
public class RotatedRectTest extends OpenCVTestCase { public class RotatedRectTest extends OpenCVTestCase {
private Point center;
private Size size;
private double angle;
@Override
protected void setUp() throws Exception {
super.setUp();
center = new Point(matSize/2, matSize/2);
size = new Size(matSize/4, matSize/2);
angle = 40;
}
public void test_1() {
super.test_1("core.RotatedRect");
}
public void testBoundingRect() { public void testBoundingRect() {
Point center = new Point(matSize/2, matSize/2); assertEquals(size.height, size.width);
double length1 = matSize/4; double length = size.height;
Size size = new Size(length1, length1);
double angle = 45;
RotatedRect rr = new RotatedRect(center, size, angle);
Rect r = rr.boundingRect(); angle = 45;
RotatedRect rr = new RotatedRect(center, size, angle);
OpenCVTestRunner.Log("testBoundingRect: r="+r.toString()); Rect r = rr.boundingRect();
OpenCVTestRunner.Log("testBoundingRect: center.x + length1*Math.sqrt(2)/2="+ (center.x + length1*Math.sqrt(2)/2)); double halfDiagonal = length * Math.sqrt(2)/2;
OpenCVTestRunner.Log("testBoundingRect: length1*Math.sqrt(2)="+ (length1*Math.sqrt(2)));
assertTrue( assertTrue((r.x == Math.floor(center.x - halfDiagonal)) &&
(r.x == Math.floor(center.x - length1*Math.sqrt(2)/2)) (r.y == Math.floor(center.y - halfDiagonal)));
&&
(r.y == Math.floor(center.y - length1*Math.sqrt(2)/2)));
assertTrue( assertTrue((r.br().x >= Math.ceil(center.x + halfDiagonal)) &&
(r.br().x >= Math.ceil(center.x + length1*Math.sqrt(2)/2)) (r.br().y >= Math.ceil(center.y + halfDiagonal)));
&&
(r.br().y >= Math.ceil(center.y + length1*Math.sqrt(2)/2)));
assertTrue( assertTrue((r.br().x - Math.ceil(center.x + halfDiagonal)) <= 1 &&
(r.br().x - Math.ceil(center.x + length1*Math.sqrt(2)/2)) <= 1 (r.br().y - Math.ceil(center.y + halfDiagonal)) <= 1);
&&
(r.br().y - Math.ceil(center.y + length1*Math.sqrt(2)/2)) <= 1);
} }
public void testClone() { public void testClone() {
Point center = new Point(matSize/2, matSize/2); RotatedRect rrect = new RotatedRect(center, size, angle);
Size size = new Size(matSize/4, matSize/2); RotatedRect clone = rrect.clone();
double angle = 40;
RotatedRect rr1 = new RotatedRect(center, size, angle); assertTrue(clone != null);
RotatedRect rr1c = rr1.clone(); assertTrue(rrect.center.equals(clone.center));
assertTrue(rrect.size.equals(clone.size));
assertTrue(rr1c != null); assertTrue(rrect.angle == clone.angle);
assertTrue(rr1.center.equals(rr1c.center));
assertTrue(rr1.size.equals(rr1c.size));
assertTrue(rr1.angle == rr1c.angle);
} }
public void testEqualsObject() { public void testEqualsObject() {
Point center = new Point(matSize/2, matSize/2);
Size size = new Size(matSize/4, matSize/2);
double angle = 40;
Point center2 = new Point(matSize/3, matSize/1.5); Point center2 = new Point(matSize/3, matSize/1.5);
Size size2 = new Size(matSize/2, matSize/4); Size size2 = new Size(matSize/2, matSize/4);
double angle2 = 0; double angle2 = 0;
RotatedRect rr1 = new RotatedRect(center, size, angle); RotatedRect rrect1 = new RotatedRect(center, size, angle);
RotatedRect rr2 = new RotatedRect(center2, size2, angle2); RotatedRect rrect2 = new RotatedRect(center2, size2, angle2);
RotatedRect rr1c = rr1.clone(); RotatedRect rrect3 = rrect1;
RotatedRect rr3 = rr2.clone(); RotatedRect clone1 = rrect1.clone();
RotatedRect rr11=rr1; RotatedRect clone2 = rrect2.clone();
rr3.angle=10;
assertTrue(rrect1.equals(rrect3));
assertTrue(rr1.equals(rr11)); assertTrue(!rrect1.equals(rrect2));
assertTrue(!rr1.equals(rr2));
assertTrue(rr1.equals(rr1c)); assertTrue(rrect2.equals(clone2));
assertTrue(!rr2.equals(rr3)); clone2.angle = 10;
assertTrue(!rrect2.equals(clone2));
rr1c.center.x+=1; assertTrue(rrect1.equals(clone1));
assertTrue(!rr1.equals(rr1c));
rr1c.center.x-=1; clone1.center.x += 1;
assertTrue(rr1.equals(rr1c)); assertTrue(!rrect1.equals(clone1));
clone1.center.x -= 1;
assertTrue(rrect1.equals(clone1));
rr1c.size.width+=1; clone1.size.width += 1;
assertTrue(!rr1.equals(rr1c)); assertTrue(!rrect1.equals(clone1));
assertTrue(! rr1.equals(size)); assertTrue(!rrect1.equals(size));
} }
public void testPoints() { public void testPoints() {
Point center = new Point(matSize/2, matSize/2); RotatedRect rrect = new RotatedRect(center, size, angle);
Size size = new Size(matSize/4, matSize/2);
double angle = 40;
RotatedRect rr = new RotatedRect(center, size, angle);
Point p[] = new Point[4];
rr.points(p); Point p[] = new Point[4];
rrect.points(p);
boolean is_p0_irrational = (100*p[0].x!=(int)(100*p[0].x)) && (100*p[0].y!=(int)(100*p[0].y)); boolean is_p0_irrational = (100 * p[0].x != (int)(100 * p[0].x)) && (100 * p[0].y != (int)(100 * p[0].y));
boolean is_p1_irrational = (100*p[1].x!=(int)(100*p[1].x)) && (100*p[1].y!=(int)(100*p[1].y)); boolean is_p1_irrational = (100 * p[1].x != (int)(100 * p[1].x)) && (100 * p[1].y != (int)(100 * p[1].y));
boolean is_p2_irrational = (100*p[2].x!=(int)(100*p[2].x)) && (100*p[2].y!=(int)(100*p[2].y)); boolean is_p2_irrational = (100 * p[2].x != (int)(100 * p[2].x)) && (100 * p[2].y != (int)(100 * p[2].y));
boolean is_p3_irrational = (100*p[3].x!=(int)(100*p[3].x)) && (100*p[3].y!=(int)(100*p[3].y)); boolean is_p3_irrational = (100 * p[3].x != (int)(100 * p[3].x)) && (100 * p[3].y != (int)(100 * p[3].y));
assertTrue(is_p0_irrational && is_p1_irrational && is_p2_irrational && is_p3_irrational); assertTrue(is_p0_irrational && is_p1_irrational && is_p2_irrational && is_p3_irrational);
assertTrue("Symmetric points 0 and 2", assertTrue("Symmetric points 0 and 2",
Math.abs((p[0].x + p[2].x)/2 - center.x) + Math.abs((p[0].y + p[2].y)/2 - center.y) < 0.001); Math.abs((p[0].x + p[2].x)/2 - center.x) + Math.abs((p[0].y + p[2].y)/2 - center.y) < EPS);
assertTrue("Symmetric points 1 and 3", assertTrue("Symmetric points 1 and 3",
Math.abs((p[1].x + p[3].x)/2 - center.x) + Math.abs((p[1].y + p[3].y)/2 - center.y) < 0.001); Math.abs((p[1].x + p[3].x)/2 - center.x) + Math.abs((p[1].y + p[3].y)/2 - center.y) < EPS);
assertTrue("Orthogonal vectors 01 and 12", assertTrue("Orthogonal vectors 01 and 12",
Math.abs( (p[1].x - p[0].x) * (p[2].x - p[1].x) + (p[1].y - p[0].y) * (p[2].y - p[1].y) ) < 0.001); Math.abs((p[1].x - p[0].x) * (p[2].x - p[1].x) + (p[1].y - p[0].y) * (p[2].y - p[1].y) ) < EPS);
assertTrue("Orthogonal vectors 12 and 23", assertTrue("Orthogonal vectors 12 and 23",
Math.abs( (p[2].x - p[1].x) * (p[3].x - p[2].x) + (p[2].y - p[1].y) * (p[3].y - p[2].y) ) < 0.001); Math.abs((p[2].x - p[1].x) * (p[3].x - p[2].x) + (p[2].y - p[1].y) * (p[3].y - p[2].y) ) < EPS);
assertTrue("Orthogonal vectors 23 and 30", assertTrue("Orthogonal vectors 23 and 30",
Math.abs( (p[3].x - p[2].x) * (p[0].x - p[3].x) + (p[3].y - p[2].y) * (p[0].y - p[3].y) ) < 0.001); Math.abs((p[3].x - p[2].x) * (p[0].x - p[3].x) + (p[3].y - p[2].y) * (p[0].y - p[3].y) ) < EPS);
assertTrue("Orthogonal vectors 30 and 01", assertTrue("Orthogonal vectors 30 and 01",
Math.abs( (p[0].x - p[3].x) * (p[1].x - p[0].x) + (p[0].y - p[3].y) * (p[1].y - p[0].y) ) < 0.001); Math.abs((p[0].x - p[3].x) * (p[1].x - p[0].x) + (p[0].y - p[3].y) * (p[1].y - p[0].y) ) < EPS);
assertTrue("Length of the vector 01", assertTrue("Length of the vector 01",
Math.abs( Math.abs((p[1].x - p[0].x) * (p[1].x - p[0].x) + (p[1].y - p[0].y) * (p[1].y - p[0].y) - size.height * size.height) < EPS);
(p[1].x - p[0].x) * (p[1].x - p[0].x) + (p[1].y - p[0].y)*(p[1].y - p[0].y)
-
size.height * size.height
) < 0.001);
assertTrue("Length of the vector 21", assertTrue("Length of the vector 21",
Math.abs( Math.abs((p[1].x - p[2].x) * (p[1].x - p[2].x) + (p[1].y - p[2].y) * (p[1].y - p[2].y) - size.width * size.width ) < EPS);
(p[1].x - p[2].x) * (p[1].x - p[2].x) + (p[1].y - p[2].y)*(p[1].y - p[2].y)
-
size.width * size.width
) < 0.001);
assertTrue("Angle of the vector 21 with the axes", assertTrue("Angle of the vector 21 with the axes",
Math.abs( Math.abs((p[2].x - p[1].x) / size.width - Math.cos(angle * Math.PI / 180)) < EPS);
(p[2].x - p[1].x) / size.width
-
Math.cos(angle * Math.PI / 180)
) < 0.001);
} }
...@@ -149,7 +135,7 @@ public class RotatedRectTest extends OpenCVTestCase { ...@@ -149,7 +135,7 @@ public class RotatedRectTest extends OpenCVTestCase {
} }
public void testRotatedRectPointSizeDouble() { public void testRotatedRectPointSizeDouble() {
RotatedRect rr = new RotatedRect(new Point(matSize/2, matSize/2), new Size(matSize/4, matSize/2), 45); RotatedRect rr = new RotatedRect(center, size, 40);
assertTrue(rr != null); assertTrue(rr != null);
} }
......
...@@ -13,8 +13,6 @@ public class coreTest extends OpenCVTestCase { ...@@ -13,8 +13,6 @@ public class coreTest extends OpenCVTestCase {
public void test_1() { public void test_1() {
super.test_1("CORE"); super.test_1("CORE");
//System.gc();
} }
public void testAbsdiff() { public void testAbsdiff() {
...@@ -39,7 +37,7 @@ public class coreTest extends OpenCVTestCase { ...@@ -39,7 +37,7 @@ public class coreTest extends OpenCVTestCase {
public void testAddMatMatMatMatInt() { public void testAddMatMatMatMatInt() {
core.add(gray0, gray1, dst, gray1, CvType.CV_32F); core.add(gray0, gray1, dst, gray1, CvType.CV_32F);
assertTrue(CvType.CV_32F == dst.depth()); assertTrue(CvType.CV_32F == dst.depth());
// FIXME: must work assertMatEqual(gray1_32f, dst); assertMatEqual(gray1_32f, dst);
} }
public void testAddWeightedMatDoubleMatDoubleDoubleMat() { public void testAddWeightedMatDoubleMatDoubleDoubleMat() {
...@@ -48,9 +46,9 @@ public class coreTest extends OpenCVTestCase { ...@@ -48,9 +46,9 @@ public class coreTest extends OpenCVTestCase {
} }
public void testAddWeightedMatDoubleMatDoubleDoubleMatInt() { public void testAddWeightedMatDoubleMatDoubleDoubleMatInt() {
core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst, gray255_32f.depth()); core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst);//FIXME: #1224, CvType.CV_32F
assertTrue(CvType.CV_32F == dst.depth()); assertTrue(CvType.CV_32F == dst.depth());
//FIXME: must work //TODO: assertMatEqual(gray255_32f, dst);
} }
public void testBitwise_andMatMatMat() { public void testBitwise_andMatMatMat() {
...@@ -121,8 +119,8 @@ public class coreTest extends OpenCVTestCase { ...@@ -121,8 +119,8 @@ public class coreTest extends OpenCVTestCase {
public void testCheckHardwareSupport() { public void testCheckHardwareSupport() {
//XXX: core.checkHardwareSupport(feature) //XXX: core.checkHardwareSupport(feature)
boolean hasFeauture = core.checkHardwareSupport(0); //boolean hasFeauture = core.checkHardwareSupport(0);
assertEquals(false, hasFeauture); //assertEquals(false, hasFeauture);
} }
public void testCircleMatPointIntScalar() { public void testCircleMatPointIntScalar() {
...@@ -588,22 +586,24 @@ public class coreTest extends OpenCVTestCase { ...@@ -588,22 +586,24 @@ public class coreTest extends OpenCVTestCase {
core.min(gray0, gray255, dst); core.min(gray0, gray255, dst);
assertMatEqual(gray0, dst); assertMatEqual(gray0, dst);
} }
public void testMinMaxLoc() { public void testMinMaxLoc() {
double minVal=1; double minVal=1;
double maxVal=10; double maxVal=10;
Point minLoc = new Point((int)matSize/4, (int)matSize/2); Point minLoc = new Point((int)matSize/4, (int)matSize/2);
Point maxLoc = new Point((int)matSize/2, (int)matSize/4); Point maxLoc = new Point((int)matSize/2, (int)matSize/4);
gray3.put((int)minLoc.y, (int)minLoc.x, minVal); gray3.put((int)minLoc.y, (int)minLoc.x, minVal);
gray3.put((int)maxLoc.y, (int)maxLoc.x, maxVal); gray3.put((int)maxLoc.y, (int)maxLoc.x, maxVal);
core.MinMaxLocResult mmres = core.minMaxLoc(gray3); core.MinMaxLocResult mmres = core.minMaxLoc(gray3);
assertTrue(mmres.minVal==minVal assertTrue(mmres.minVal==minVal
&& mmres.maxVal==maxVal && mmres.maxVal==maxVal
&& mmres.minLoc.equals(minLoc) && mmres.minLoc.equals(minLoc)
&& mmres.maxLoc.equals(maxLoc)); && mmres.maxLoc.equals(maxLoc));
} }
public void testMulSpectrumsMatMatMatInt() { public void testMulSpectrumsMatMatMatInt() {
//TODO: nice example //TODO: nice example
fail("Not yet implemented"); fail("Not yet implemented");
...@@ -777,8 +777,8 @@ public class coreTest extends OpenCVTestCase { ...@@ -777,8 +777,8 @@ public class coreTest extends OpenCVTestCase {
} }
public void testSetIdentityMat() { public void testSetIdentityMat() {
core.setIdentity(dst); core.setIdentity(gray0);
assertTrue(dst.rows() == core.countNonZero(dst)); assertTrue(gray0.rows() == core.countNonZero(gray0));
} }
public void testSetIdentityMatScalar() { public void testSetIdentityMatScalar() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment