|
|
@ -1,11 +1,13 @@ |
|
|
|
package org.opencv.test.core; |
|
|
|
package org.opencv.test.core; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
|
|
|
|
import org.opencv.CvType; |
|
|
|
import org.opencv.CvType; |
|
|
|
import org.opencv.Mat; |
|
|
|
import org.opencv.Mat; |
|
|
|
import org.opencv.Point; |
|
|
|
import org.opencv.Point; |
|
|
|
|
|
|
|
import org.opencv.Rect; |
|
|
|
import org.opencv.Scalar; |
|
|
|
import org.opencv.Scalar; |
|
|
|
import org.opencv.core; |
|
|
|
import org.opencv.core; |
|
|
|
|
|
|
|
|
|
|
|
import org.opencv.test.OpenCVTestCase; |
|
|
|
import org.opencv.test.OpenCVTestCase; |
|
|
|
import org.opencv.test.OpenCVTestRunner; |
|
|
|
import org.opencv.test.OpenCVTestRunner; |
|
|
|
|
|
|
|
|
|
|
@ -141,7 +143,6 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
core.cartToPolar(x, y, dst, dst_angle,false); |
|
|
|
core.cartToPolar(x, y, dst, dst_angle,false); |
|
|
|
|
|
|
|
|
|
|
|
assertMatEqual(magnitude, dst); |
|
|
|
assertMatEqual(magnitude, dst); |
|
|
|
OpenCVTestRunner.Log(dst_angle.dump()); |
|
|
|
|
|
|
|
assertMatEqual(angle, dst_angle); |
|
|
|
assertMatEqual(angle, dst_angle); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -173,6 +174,31 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
fail("Not yet implemented"); |
|
|
|
fail("Not yet implemented"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testClipLine() { |
|
|
|
|
|
|
|
Rect r = new Rect(10, 10, 10, 10); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Point pt1 = new Point(5.0, 15.0); |
|
|
|
|
|
|
|
Point pt2 = new Point(25.0, 15.0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Point pt1Clipped = new Point(10.0, 15.0); |
|
|
|
|
|
|
|
Point pt2Clipped = new Point(19.0, 15.0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean res = core.clipLine(r, pt1, pt2); |
|
|
|
|
|
|
|
assertEquals(true, res); |
|
|
|
|
|
|
|
assertEquals(pt1Clipped, pt1); |
|
|
|
|
|
|
|
assertEquals(pt2Clipped, pt2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pt1 = new Point(5.0, 5.0); |
|
|
|
|
|
|
|
pt2 = new Point(25.0, 5.0); |
|
|
|
|
|
|
|
pt1Clipped = new Point(5.0, 5.0); |
|
|
|
|
|
|
|
pt2Clipped = new Point(25.0, 5.0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
res = core.clipLine(r, pt1, pt2); |
|
|
|
|
|
|
|
assertEquals(false, res); |
|
|
|
|
|
|
|
assertEquals(pt1Clipped, pt1); |
|
|
|
|
|
|
|
assertEquals(pt2Clipped, pt2); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testCompare() { |
|
|
|
public void testCompare() { |
|
|
|
core.compare(gray0, gray0, dst, core.CMP_EQ); |
|
|
|
core.compare(gray0, gray0, dst, core.CMP_EQ); |
|
|
|
assertMatEqual(dst, gray255); |
|
|
|
assertMatEqual(dst, gray255); |
|
|
@ -329,6 +355,10 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
assertMatEqual(gray3, dst); |
|
|
|
assertMatEqual(gray3, dst); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testEllipse2Poly() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testEllipseMatPointSizeDoubleDoubleDoubleScalar() { |
|
|
|
public void testEllipseMatPointSizeDoubleDoubleDoubleScalar() { |
|
|
|
fail("Not yet implemented"); |
|
|
|
fail("Not yet implemented"); |
|
|
|
} |
|
|
|
} |
|
|
@ -345,6 +375,18 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
fail("Not yet implemented"); |
|
|
|
fail("Not yet implemented"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testEllipseMatRotatedRectScalar() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testEllipseMatRotatedRectScalarInt() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testEllipseMatRotatedRectScalarIntInt() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testExp() { |
|
|
|
public void testExp() { |
|
|
|
Mat destination = new Mat(matSize, matSize, CvType.CV_32F); destination.setTo(new Scalar(0.0)); |
|
|
|
Mat destination = new Mat(matSize, matSize, CvType.CV_32F); destination.setTo(new Scalar(0.0)); |
|
|
|
core.exp(gray0_32f, destination); |
|
|
|
core.exp(gray0_32f, destination); |
|
|
@ -443,6 +485,10 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
assertEquals(15, largeVecSize); |
|
|
|
assertEquals(15, largeVecSize); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testGetTextSize() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testGetTickFrequency() { |
|
|
|
public void testGetTickFrequency() { |
|
|
|
double freq = 0.0; |
|
|
|
double freq = 0.0; |
|
|
|
freq = core.getTickFrequency(); |
|
|
|
freq = core.getTickFrequency(); |
|
|
@ -458,7 +504,6 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
assertMatEqual(eConcat, dst); |
|
|
|
assertMatEqual(eConcat, dst); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testIdctMatMat() { |
|
|
|
public void testIdctMatMat() { |
|
|
|
Mat in = new Mat(1, 8, CvType.CV_32F); |
|
|
|
Mat in = new Mat(1, 8, CvType.CV_32F); |
|
|
|
Mat out = new Mat(1, 8, CvType.CV_32F); |
|
|
|
Mat out = new Mat(1, 8, CvType.CV_32F); |
|
|
@ -538,8 +583,6 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
answer.put(1, 1, 1.0); |
|
|
|
answer.put(1, 1, 1.0); |
|
|
|
|
|
|
|
|
|
|
|
core.invert(src, dst); |
|
|
|
core.invert(src, dst); |
|
|
|
OpenCVTestRunner.Log(answer.dump()); |
|
|
|
|
|
|
|
OpenCVTestRunner.Log(dst.dump()); |
|
|
|
|
|
|
|
assertMatEqual(answer, dst); |
|
|
|
assertMatEqual(answer, dst); |
|
|
|
|
|
|
|
|
|
|
|
//TODO: needs epsilon comparison
|
|
|
|
//TODO: needs epsilon comparison
|
|
|
@ -568,6 +611,14 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
assertTrue(det > 0.0); |
|
|
|
assertTrue(det > 0.0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testKmeansMatIntMatTermCriteriaIntInt() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testKmeansMatIntMatTermCriteriaIntIntMat() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testLineMatPointPointScalar() { |
|
|
|
public void testLineMatPointPointScalar() { |
|
|
|
int nPoints = Math.min(gray0.cols(), gray0.rows()); |
|
|
|
int nPoints = Math.min(gray0.cols(), gray0.rows()); |
|
|
|
|
|
|
|
|
|
|
@ -596,6 +647,7 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
fail("Not yet implemented"); |
|
|
|
fail("Not yet implemented"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testLineMatPointPointScalarIntIntInt() { |
|
|
|
public void testLineMatPointPointScalarIntIntInt() { |
|
|
|
fail("Not yet implemented"); |
|
|
|
fail("Not yet implemented"); |
|
|
|
} |
|
|
|
} |
|
|
@ -676,6 +728,17 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
assertMatEqual(dst, dst); |
|
|
|
assertMatEqual(dst, dst); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testMeanMat() { |
|
|
|
|
|
|
|
Scalar mean = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mean = core.mean(gray128); |
|
|
|
|
|
|
|
assertEquals(new Scalar(128), mean); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testMeanMatMat() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testMeanStdDevMatMatMat() { |
|
|
|
public void testMeanStdDevMatMatMat() { |
|
|
|
Mat mean = new Mat(); |
|
|
|
Mat mean = new Mat(); |
|
|
|
Mat stddev = new Mat(); |
|
|
|
Mat stddev = new Mat(); |
|
|
@ -710,6 +773,10 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
assertTrue(0 != core.countNonZero(stddev)); |
|
|
|
assertTrue(0 != core.countNonZero(stddev)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testMerge() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testMin() { |
|
|
|
public void testMin() { |
|
|
|
core.min(gray0, gray255, dst); |
|
|
|
core.min(gray0, gray255, dst); |
|
|
|
assertMatEqual(gray0, dst); |
|
|
|
assertMatEqual(gray0, dst); |
|
|
@ -731,6 +798,14 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
assertTrue(mmres.maxLoc.equals(maxLoc)); |
|
|
|
assertTrue(mmres.maxLoc.equals(maxLoc)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testMinMaxLocMat() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testMinMaxLocMatMat() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testMulSpectrumsMatMatMatInt() { |
|
|
|
public void testMulSpectrumsMatMatMatInt() { |
|
|
|
Mat src1 = new Mat(1, 4, CvType.CV_32F); |
|
|
|
Mat src1 = new Mat(1, 4, CvType.CV_32F); |
|
|
|
Mat src2 = new Mat(1, 4, CvType.CV_32F); |
|
|
|
Mat src2 = new Mat(1, 4, CvType.CV_32F); |
|
|
@ -912,8 +987,6 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
res.put(0, 0, 63.434, 56.310, 44.999, 75.963); |
|
|
|
res.put(0, 0, 63.434, 56.310, 44.999, 75.963); |
|
|
|
|
|
|
|
|
|
|
|
core.phase(x, y, dst, true); |
|
|
|
core.phase(x, y, dst, true); |
|
|
|
OpenCVTestRunner.Log(res.dump()); |
|
|
|
|
|
|
|
OpenCVTestRunner.Log(dst.dump()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testPolarToCartMatMatMatMat() { |
|
|
|
public void testPolarToCartMatMatMatMat() { |
|
|
@ -937,10 +1010,6 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
|
|
|
|
|
|
|
|
//TODO: needs epsilon comparison
|
|
|
|
//TODO: needs epsilon comparison
|
|
|
|
core.polarToCart(magnitude, angle, xCoordinate, yCoordinate); |
|
|
|
core.polarToCart(magnitude, angle, xCoordinate, yCoordinate); |
|
|
|
OpenCVTestRunner.Log(x.dump()); |
|
|
|
|
|
|
|
OpenCVTestRunner.Log(xCoordinate.dump()); |
|
|
|
|
|
|
|
OpenCVTestRunner.Log(y.dump()); |
|
|
|
|
|
|
|
OpenCVTestRunner.Log(yCoordinate.dump()); |
|
|
|
|
|
|
|
assertMatEqual(x, xCoordinate); |
|
|
|
assertMatEqual(x, xCoordinate); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -953,6 +1022,22 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
assertMatEqual(gray9, dst); |
|
|
|
assertMatEqual(gray9, dst); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testPutTextMatStringPointIntDoubleScalar() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testPutTextMatStringPointIntDoubleScalarInt() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testPutTextMatStringPointIntDoubleScalarIntInt() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testPutTextMatStringPointIntDoubleScalarIntIntBoolean() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testRandn() { |
|
|
|
public void testRandn() { |
|
|
|
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)); |
|
|
@ -1113,10 +1198,7 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
coeffs.put(0, 0, -6, 11, -6, 1); |
|
|
|
coeffs.put(0, 0, -6, 11, -6, 1); |
|
|
|
|
|
|
|
|
|
|
|
Mat answer = new Mat(3, 1, CvType.CV_32FC2); |
|
|
|
Mat answer = new Mat(3, 1, CvType.CV_32FC2); |
|
|
|
//FIXME: doesn't work answer.put(0, 0, 1, 0, 2, 0, 3, 0);
|
|
|
|
answer.put(0, 0, 1, 0, 2, 0, 3, 0); |
|
|
|
answer.put(0, 0, 1, 0); |
|
|
|
|
|
|
|
answer.put(1, 0, 2, 0); |
|
|
|
|
|
|
|
answer.put(2, 0, 3, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
core.solvePoly(coeffs, roots); |
|
|
|
core.solvePoly(coeffs, roots); |
|
|
|
assertMatEqual(answer, roots); |
|
|
|
assertMatEqual(answer, roots); |
|
|
@ -1129,10 +1211,7 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
coeffs.put(0, 0, -6, 11, -6, 1); |
|
|
|
coeffs.put(0, 0, -6, 11, -6, 1); |
|
|
|
|
|
|
|
|
|
|
|
Mat answer = new Mat(3, 1, CvType.CV_32FC2); |
|
|
|
Mat answer = new Mat(3, 1, CvType.CV_32FC2); |
|
|
|
//FIXME: doesn't work answer.put(0, 0, 1, 0, 2, 0, 3, 0);
|
|
|
|
answer.put(0, 0, 1, 0, -1, 2, -2, 12); |
|
|
|
answer.put(0, 0, 1, 0); |
|
|
|
|
|
|
|
answer.put(1, 0, -1, 2); |
|
|
|
|
|
|
|
answer.put(2, 0, -2, 12); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
core.solvePoly(coeffs, roots, 1); |
|
|
|
core.solvePoly(coeffs, roots, 1); |
|
|
|
assertMatEqual(answer, roots); |
|
|
|
assertMatEqual(answer, roots); |
|
|
@ -1164,6 +1243,17 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
assertMatEqual(answer, b); |
|
|
|
assertMatEqual(answer, b); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testSqrt() { |
|
|
|
public void testSqrt() { |
|
|
|
core.sqrt(gray9_32f, dst); |
|
|
|
core.sqrt(gray9_32f, dst); |
|
|
|
assertMatEqual(gray3_32f, dst); |
|
|
|
assertMatEqual(gray3_32f, dst); |
|
|
@ -1198,6 +1288,14 @@ public class coreTest extends OpenCVTestCase { |
|
|
|
assertMatEqual(gray1_32f, dst); |
|
|
|
assertMatEqual(gray1_32f, dst); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testSumElems() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testTrace() { |
|
|
|
|
|
|
|
fail("Not yet implemented"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testTransform() { |
|
|
|
public void testTransform() { |
|
|
|
Mat src = new Mat(2, 2, CvType.CV_32F, new Scalar(55)); |
|
|
|
Mat src = new Mat(2, 2, CvType.CV_32F, new Scalar(55)); |
|
|
|
Mat m = Mat.eye(2, 2, CvType.CV_32FC1); |
|
|
|
Mat m = Mat.eye(2, 2, CvType.CV_32FC1); |
|
|
|