Added new tests written by Hussein Abdinoor; Added support for new classes in features2d and imgproc
This commit is contained in:
parent
d3f8b2eeb7
commit
25261e6ebc
@ -15,6 +15,7 @@ import org.opencv.core.Core;
|
|||||||
import org.opencv.core.CvType;
|
import org.opencv.core.CvType;
|
||||||
import org.opencv.core.Mat;
|
import org.opencv.core.Mat;
|
||||||
import org.opencv.core.Point;
|
import org.opencv.core.Point;
|
||||||
|
import org.opencv.core.Point3;
|
||||||
import org.opencv.core.Rect;
|
import org.opencv.core.Rect;
|
||||||
import org.opencv.core.Scalar;
|
import org.opencv.core.Scalar;
|
||||||
import org.opencv.features2d.DMatch;
|
import org.opencv.features2d.DMatch;
|
||||||
@ -221,6 +222,15 @@ public class OpenCVTestCase extends TestCase {
|
|||||||
assertPointEquals(list1.get(i), list2.get(i), epsilon);
|
assertPointEquals(list1.get(i), list2.get(i), epsilon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void assertListPoint3Equals(List<Point3> list1, List<Point3> list2, double epsilon) {
|
||||||
|
if (list1.size() != list2.size()) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < list1.size(); i++)
|
||||||
|
assertPoint3Equals(list1.get(i), list2.get(i), epsilon);
|
||||||
|
}
|
||||||
|
|
||||||
public static void assertListRectEquals(List<Rect> list1, List<Rect> list2) {
|
public static void assertListRectEquals(List<Rect> list1, List<Rect> list2) {
|
||||||
if (list1.size() != list2.size()) {
|
if (list1.size() != list2.size()) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
@ -297,6 +307,13 @@ public class OpenCVTestCase extends TestCase {
|
|||||||
assertEquals(msg, expected.x, actual.x, eps);
|
assertEquals(msg, expected.x, actual.x, eps);
|
||||||
assertEquals(msg, expected.y, actual.y, eps);
|
assertEquals(msg, expected.y, actual.y, eps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void assertPoint3Equals(Point3 expected, Point3 actual, double eps) {
|
||||||
|
String msg = "expected:<" + expected + "> but was:<" + actual + ">";
|
||||||
|
assertEquals(msg, expected.x, actual.x, eps);
|
||||||
|
assertEquals(msg, expected.y, actual.y, eps);
|
||||||
|
assertEquals(msg, expected.z, actual.z, eps);
|
||||||
|
}
|
||||||
|
|
||||||
static private void compareMats(Mat expected, Mat actual, boolean isEqualityMeasured) {
|
static private void compareMats(Mat expected, Mat actual, boolean isEqualityMeasured) {
|
||||||
if (expected.type() != actual.type() || expected.cols() != actual.cols() || expected.rows() != actual.rows()) {
|
if (expected.type() != actual.type() || expected.cols() != actual.cols() || expected.rows() != actual.rows()) {
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
package org.opencv.test.core;
|
package org.opencv.test.core;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import org.opencv.core.Core;
|
||||||
|
|
||||||
import org.opencv.core.CvType;
|
import org.opencv.core.CvType;
|
||||||
import org.opencv.core.Mat;
|
import org.opencv.core.Mat;
|
||||||
|
import org.opencv.core.Range;
|
||||||
|
import org.opencv.core.Rect;
|
||||||
import org.opencv.core.Scalar;
|
import org.opencv.core.Scalar;
|
||||||
|
import org.opencv.core.Size;
|
||||||
import org.opencv.test.OpenCVTestCase;
|
import org.opencv.test.OpenCVTestCase;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class MatTest extends OpenCVTestCase {
|
public class MatTest extends OpenCVTestCase {
|
||||||
|
|
||||||
public void testAdjustROI() {
|
public void testAdjustROI() {
|
||||||
@ -14,7 +18,11 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testAssignToMat() {
|
public void testAssignToMat() {
|
||||||
fail("Not yet implemented");
|
gray0.assignTo(dst);
|
||||||
|
assertMatEqual(gray0, dst);
|
||||||
|
|
||||||
|
gray255.assignTo(dst);
|
||||||
|
assertMatEqual(gray255, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAssignToMatInt() {
|
public void testAssignToMatInt() {
|
||||||
@ -28,6 +36,8 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testCheckVectorInt() {
|
public void testCheckVectorInt() {
|
||||||
|
// ! returns N if the matrix is 1-channel (N x ptdim) or ptdim-channel
|
||||||
|
// (1 x N) or (N x 1); negative number otherwise
|
||||||
fail("Not yet implemented");
|
fail("Not yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,12 +64,17 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
public void testColRangeIntInt() {
|
public void testColRangeIntInt() {
|
||||||
Mat cols = gray0.colRange(0, gray0.cols() / 2);
|
Mat cols = gray0.colRange(0, gray0.cols() / 2);
|
||||||
|
|
||||||
assertEquals(gray0.cols() / 2, cols.cols());
|
assertEquals(gray0.cols() / 2, cols.cols());
|
||||||
assertEquals(gray0.rows(), cols.rows());
|
assertEquals(gray0.rows(), cols.rows());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testColRangeRange() {
|
public void testColRangeRange() {
|
||||||
fail("Not yet implemented");
|
Range range = new Range(0, 5);
|
||||||
|
dst = gray0.colRange(range);
|
||||||
|
|
||||||
|
truth = new Mat(10, 5, CvType.CV_8UC1, new Scalar(0.0));
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCols() {
|
public void testCols() {
|
||||||
@ -67,36 +82,64 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testConvertToMatInt() {
|
public void testConvertToMatInt() {
|
||||||
fail("Not yet implemented");
|
gray255.convertTo(dst, CvType.CV_32F);
|
||||||
|
|
||||||
|
truth = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(255));
|
||||||
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConvertToMatIntDouble() {
|
public void testConvertToMatIntDouble() {
|
||||||
fail("Not yet implemented");
|
gray2.convertTo(dst, CvType.CV_16U, 2.0);
|
||||||
|
|
||||||
|
truth = new Mat(matSize, matSize, CvType.CV_16U, new Scalar(4));
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConvertToMatIntDoubleDouble() {
|
public void testConvertToMatIntDoubleDouble() {
|
||||||
fail("Not yet implemented");
|
gray0_32f.convertTo(dst, CvType.CV_8U, 2.0, 4.0);
|
||||||
|
|
||||||
|
truth = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(4));
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCopyTo() {
|
public void testCopyToMat() {
|
||||||
rgbLena.copyTo(dst);
|
rgbLena.copyTo(dst);
|
||||||
assertMatEqual(rgbLena, dst);
|
assertMatEqual(rgbLena, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCopyToMat() {
|
|
||||||
fail("Not yet implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testCopyToMatMat() {
|
public void testCopyToMatMat() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(4, 4, CvType.CV_8U, new Scalar(5));
|
||||||
|
Mat mask = makeMask(src.clone());
|
||||||
|
|
||||||
|
src.copyTo(dst, mask);
|
||||||
|
|
||||||
|
truth = new Mat(4, 4, CvType.CV_8U) {
|
||||||
|
{
|
||||||
|
put(0, 0, 0, 0, 5, 5);
|
||||||
|
put(1, 0, 0, 0, 5, 5);
|
||||||
|
put(2, 0, 0, 0, 5, 5);
|
||||||
|
put(3, 0, 0, 0, 5, 5);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateIntIntInt() {
|
public void testCreateIntIntInt() {
|
||||||
fail("Not yet implemented");
|
gray255.create(4, 5, CvType.CV_32F);
|
||||||
|
|
||||||
|
assertEquals(4, gray255.rows());
|
||||||
|
assertEquals(5, gray255.cols());
|
||||||
|
assertEquals(CvType.CV_32F, gray255.type());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateSizeInt() {
|
public void testCreateSizeInt() {
|
||||||
fail("Not yet implemented");
|
Size size = new Size(5, 5);
|
||||||
|
dst.create(size, CvType.CV_16U);
|
||||||
|
|
||||||
|
assertEquals(5, dst.rows());
|
||||||
|
assertEquals(5, dst.cols());
|
||||||
|
assertEquals(CvType.CV_16U, dst.type());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCross() {
|
public void testCross() {
|
||||||
@ -118,15 +161,25 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testDiag() {
|
public void testDiag() {
|
||||||
fail("Not yet implemented");
|
dst = gray0.diag();
|
||||||
|
|
||||||
|
truth = new Mat(10, 1, CvType.CV_8UC1, new Scalar(0));
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDiagInt() {
|
public void testDiagInt() {
|
||||||
fail("Not yet implemented");
|
dst = gray255.diag(2);
|
||||||
|
|
||||||
|
truth = new Mat(8, 1, CvType.CV_8UC1, new Scalar(255));
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDiagMat() {
|
public void testDiagMat() {
|
||||||
fail("Not yet implemented");
|
dst = Mat.diag(gray255);
|
||||||
|
|
||||||
|
truth = new Mat(1, matSize, CvType.CV_8U, new Scalar(255));
|
||||||
|
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDot() {
|
public void testDot() {
|
||||||
@ -139,13 +192,15 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testElemSize() {
|
public void testElemSize() {
|
||||||
assertEquals(1, gray0.elemSize());
|
assertEquals(Byte.SIZE / 8 * gray0.channels(), gray0.elemSize());
|
||||||
assertEquals(4, gray0_32f.elemSize());
|
assertEquals(Double.SIZE / 8 * gray0_32f.channels(), gray0_32f.elemSize());
|
||||||
assertEquals(3, rgbLena.elemSize());
|
assertEquals(Byte.SIZE / 8 * rgbLena.channels(), rgbLena.elemSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testElemSize1() {
|
public void testElemSize1() {
|
||||||
fail("Not yet implemented");
|
assertEquals(Byte.SIZE / 8, gray255.elemSize1());
|
||||||
|
assertEquals(Double.SIZE / 8, gray0_64f.elemSize1());
|
||||||
|
assertEquals(Byte.SIZE / 8, rgbLena.elemSize1());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEmpty() {
|
public void testEmpty() {
|
||||||
@ -153,21 +208,26 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
assertTrue(!gray0.empty());
|
assertTrue(!gray0.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEye() {
|
public void testEyeIntIntInt() {
|
||||||
Mat eye = Mat.eye(3, 3, CvType.CV_32FC1);
|
Mat eye = Mat.eye(3, 3, CvType.CV_32FC1);
|
||||||
|
|
||||||
assertMatEqual(eye, eye.inv(), EPS);
|
assertMatEqual(eye, eye.inv(), EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEyeIntIntInt() {
|
|
||||||
fail("Not yet implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testEyeSizeInt() {
|
public void testEyeSizeInt() {
|
||||||
fail("Not yet implemented");
|
Size size = new Size(5, 5);
|
||||||
|
|
||||||
|
Mat eye = Mat.eye(size, CvType.CV_32S);
|
||||||
|
|
||||||
|
assertEquals(5, Core.countNonZero(eye));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetIntInt() {
|
public void testGetIntInt() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(3, 3, CvType.CV_8U, new Scalar(2));
|
||||||
|
double[] actualArray = src.get(1, 1);
|
||||||
|
|
||||||
|
assertTrue(Arrays.equals(new double[] { 2 }, actualArray));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetIntIntByteArray() {
|
public void testGetIntIntByteArray() {
|
||||||
@ -187,19 +247,35 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testGetIntIntDoubleArray() {
|
public void testGetIntIntDoubleArray() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(2, 2, CvType.CV_64F);
|
||||||
|
double[] doubleArray = { 1.0, 2.0, 3.0 };
|
||||||
|
|
||||||
|
int numOfBytes = src.get(0, 0, doubleArray);
|
||||||
|
assertEquals(24, numOfBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetIntIntFloatArray() {
|
public void testGetIntIntFloatArray() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(2, 2, CvType.CV_32F);
|
||||||
|
float[] floatArray = { 3.0f, 1.0f, 4.0f };
|
||||||
|
|
||||||
|
int numOfBytes = src.get(0, 0, floatArray);
|
||||||
|
assertEquals(12, numOfBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetIntIntIntArray() {
|
public void testGetIntIntIntArray() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(2, 2, CvType.CV_32S);
|
||||||
|
int[] intArray = { 3, 1, 4, 7 };
|
||||||
|
|
||||||
|
int numOfBytes = src.get(0, 0, intArray);
|
||||||
|
assertEquals(16, numOfBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetIntIntShortArray() {
|
public void testGetIntIntShortArray() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(2, 2, CvType.CV_16U);
|
||||||
|
short[] data = { 3, 1, 4, 7 };
|
||||||
|
|
||||||
|
int numOfBytes = src.get(1, 1, data);
|
||||||
|
assertEquals(2, numOfBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetNativeObjAddr() {
|
public void testGetNativeObjAddr() {
|
||||||
@ -219,6 +295,8 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
public void testInvInt() {
|
public void testInvInt() {
|
||||||
fail("Not yet implemented");
|
fail("Not yet implemented");
|
||||||
|
dst = gray0_32f.inv(Core.DECOMP_CHOLESKY);
|
||||||
|
assertMatEqual(gray0_32f, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIsContinuous() {
|
public void testIsContinuous() {
|
||||||
@ -280,48 +358,98 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
assertMatEqual(m2, gray0_32f, EPS);
|
assertMatEqual(m2, gray0_32f, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMatLong() {
|
|
||||||
fail("Not yet implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testMatMatRange() {
|
public void testMatMatRange() {
|
||||||
fail("Not yet implemented");
|
dst = new Mat(gray0, new Range(0, 5));
|
||||||
|
|
||||||
|
truth = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0));
|
||||||
|
assertFalse(dst.empty());
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMatMatRangeRange() {
|
public void testMatMatRangeRange() {
|
||||||
fail("Not yet implemented");
|
dst = new Mat(gray255_32f, new Range(0, 5), new Range(0, 5));
|
||||||
|
|
||||||
|
truth = new Mat(5, 5, CvType.CV_32FC1, new Scalar(255));
|
||||||
|
|
||||||
|
assertFalse(dst.empty());
|
||||||
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMatMatRect() {
|
public void testMatMatRect() {
|
||||||
fail("Not yet implemented");
|
dst = new Mat(gray255_32f, new Rect(2, 2, 7, 7));
|
||||||
|
|
||||||
|
truth = new Mat(7, 7, CvType.CV_32FC1, new Scalar(255));
|
||||||
|
|
||||||
|
assertFalse(dst.empty());
|
||||||
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMatSizeInt() {
|
public void testMatSizeInt() {
|
||||||
fail("Not yet implemented");
|
dst = new Mat(new Size(10, 10), CvType.CV_8U);
|
||||||
|
|
||||||
|
assertFalse(dst.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMatSizeIntScalar() {
|
public void testMatSizeIntScalar() {
|
||||||
fail("Not yet implemented");
|
dst = new Mat(new Size(10, 10), CvType.CV_32F, new Scalar(255));
|
||||||
|
|
||||||
|
assertFalse(dst.empty());
|
||||||
|
assertMatEqual(gray255_32f, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMulMat() {
|
public void testMulMat() {
|
||||||
fail("Not yet implemented");
|
assertMatEqual(gray0, gray0.mul(gray255));
|
||||||
|
|
||||||
|
Mat m1 = new Mat(2, 2, CvType.CV_32F, new Scalar(2));
|
||||||
|
Mat m2 = new Mat(2, 2, CvType.CV_32F, new Scalar(3));
|
||||||
|
|
||||||
|
dst = m1.mul(m2);
|
||||||
|
|
||||||
|
truth = new Mat(2, 2, CvType.CV_32F, new Scalar(6));
|
||||||
|
assertMatEqual(truth, dst, EPS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMulMatDouble() {
|
public void testMulMatDouble() {
|
||||||
fail("Not yet implemented");
|
Mat m1 = new Mat(2, 2, CvType.CV_32F, new Scalar(2));
|
||||||
|
Mat m2 = new Mat(2, 2, CvType.CV_32F, new Scalar(3));
|
||||||
|
|
||||||
|
dst = m1.mul(m2, 3.0);
|
||||||
|
|
||||||
|
truth = new Mat(2, 2, CvType.CV_32F, new Scalar(18));
|
||||||
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testOnesIntIntInt() {
|
public void testOnesIntIntInt() {
|
||||||
fail("Not yet implemented");
|
dst = Mat.ones(matSize, matSize, CvType.CV_32F);
|
||||||
|
|
||||||
|
truth = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(1));
|
||||||
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testOnesSizeInt() {
|
public void testOnesSizeInt() {
|
||||||
fail("Not yet implemented");
|
dst = Mat.ones(new Size(2, 2), CvType.CV_16S);
|
||||||
|
truth = new Mat(2, 2, CvType.CV_16S, new Scalar(1));
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPush_back() {
|
public void testPush_back() {
|
||||||
fail("Not yet implemented");
|
Mat m1 = new Mat(2, 4, CvType.CV_32F, new Scalar(2));
|
||||||
|
Mat m2 = new Mat(3, 4, CvType.CV_32F, new Scalar(3));
|
||||||
|
|
||||||
|
m1.push_back(m2);
|
||||||
|
|
||||||
|
truth = new Mat(5, 4, CvType.CV_32FC1) {
|
||||||
|
{
|
||||||
|
put(0, 0, 2, 2, 2, 2);
|
||||||
|
put(1, 0, 2, 2, 2, 2);
|
||||||
|
put(2, 0, 3, 3, 3, 3);
|
||||||
|
put(3, 0, 3, 3, 3, 3);
|
||||||
|
put(4, 0, 3, 3, 3, 3);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assertMatEqual(truth, m1, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPutIntIntByteArray() {
|
public void testPutIntIntByteArray() {
|
||||||
@ -364,11 +492,19 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testReshapeInt() {
|
public void testReshapeInt() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(4, 4, CvType.CV_8U, new Scalar(0));
|
||||||
|
dst = src.reshape(4);
|
||||||
|
|
||||||
|
truth = new Mat(4, 1, CvType.CV_8UC4, new Scalar(0));
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReshapeIntInt() {
|
public void testReshapeIntInt() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(5, 7, CvType.CV_8U, new Scalar(0));
|
||||||
|
dst = src.reshape(7, 5);
|
||||||
|
|
||||||
|
truth = new Mat(5, 1, CvType.CV_8UC(7), new Scalar(0));
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRow() {
|
public void testRow() {
|
||||||
@ -385,7 +521,10 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testRowRangeRange() {
|
public void testRowRangeRange() {
|
||||||
fail("Not yet implemented");
|
Mat rows = gray255.rowRange(new Range(0, 5));
|
||||||
|
|
||||||
|
assertEquals(gray255.rows() / 2, rows.rows());
|
||||||
|
assertEquals(gray255.cols(), rows.cols());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRows() {
|
public void testRows() {
|
||||||
@ -403,15 +542,18 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
public void testSetToScalar() {
|
public void testSetToScalar() {
|
||||||
gray0.setTo(new Scalar(127));
|
gray0.setTo(new Scalar(127));
|
||||||
assertMatEqual(gray127, gray0);
|
assertMatEqual(gray127, gray0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSize() {
|
public void testSize() {
|
||||||
fail("Not yet implemented");
|
assertEquals(new Size(matSize, matSize), gray0.size());
|
||||||
|
|
||||||
|
assertEquals(new Size(3, 1), v1.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStep1() {
|
public void testStep1() {
|
||||||
fail("Not yet implemented");
|
assertEquals(10, gray0.step1());
|
||||||
|
|
||||||
|
assertEquals(3, v2.step1());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStep1Int() {
|
public void testStep1Int() {
|
||||||
@ -420,6 +562,7 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
public void testSubmatIntIntIntInt() {
|
public void testSubmatIntIntIntInt() {
|
||||||
Mat submat = gray0.submat(0, gray0.rows() / 2, 0, gray0.cols() / 2);
|
Mat submat = gray0.submat(0, gray0.rows() / 2, 0, gray0.cols() / 2);
|
||||||
|
|
||||||
assertTrue(submat.isSubmatrix());
|
assertTrue(submat.isSubmatrix());
|
||||||
assertFalse(submat.isContinuous());
|
assertFalse(submat.isContinuous());
|
||||||
assertEquals(gray0.rows() / 2, submat.rows());
|
assertEquals(gray0.rows() / 2, submat.rows());
|
||||||
@ -427,15 +570,44 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testSubmatRangeRange() {
|
public void testSubmatRangeRange() {
|
||||||
fail("Not yet implemented");
|
Mat submat = gray255.submat(new Range(2, 4), new Range(2, 4));
|
||||||
|
assertTrue(submat.isSubmatrix());
|
||||||
|
assertFalse(submat.isContinuous());
|
||||||
|
|
||||||
|
assertEquals(2, submat.rows());
|
||||||
|
assertEquals(2, submat.cols());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSubmatRect() {
|
public void testSubmatRect() {
|
||||||
fail("Not yet implemented");
|
Mat submat = gray255.submat(new Rect(5, gray255.rows() / 2, 5, gray255.cols() / 2));
|
||||||
|
assertTrue(submat.isSubmatrix());
|
||||||
|
assertFalse(submat.isContinuous());
|
||||||
|
|
||||||
|
assertEquals(gray255.rows() / 2, submat.rows());
|
||||||
|
assertEquals(gray255.cols() / 2, submat.cols());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testT() {
|
public void testT() {
|
||||||
fail("Not yet implemented");
|
assertMatEqual(gray255, gray255.t());
|
||||||
|
|
||||||
|
Mat src = new Mat(3, 3, CvType.CV_16U) {
|
||||||
|
{
|
||||||
|
put(0, 0, 1, 2, 4);
|
||||||
|
put(1, 0, 7, 5, 0);
|
||||||
|
put(2, 0, 3, 4, 6);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
dst = src.t();
|
||||||
|
|
||||||
|
truth = new Mat(3, 3, CvType.CV_16U) {
|
||||||
|
{
|
||||||
|
put(0, 0, 1, 7, 3);
|
||||||
|
put(1, 0, 2, 5, 4);
|
||||||
|
put(2, 0, 4, 0, 6);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testToString() {
|
public void testToString() {
|
||||||
@ -460,11 +632,16 @@ public class MatTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testZerosIntIntInt() {
|
public void testZerosIntIntInt() {
|
||||||
fail("Not yet implemented");
|
dst = Mat.zeros(matSize, matSize, CvType.CV_32F);
|
||||||
|
|
||||||
|
assertMatEqual(gray0_32f, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testZerosSizeInt() {
|
public void testZerosSizeInt() {
|
||||||
fail("Not yet implemented");
|
dst = Mat.zeros(new Size(2, 2), CvType.CV_16S);
|
||||||
|
|
||||||
|
truth = new Mat(2, 2, CvType.CV_16S, new Scalar(0));
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,44 @@
|
|||||||
package org.opencv.test.features2d;
|
package org.opencv.test.features2d;
|
||||||
|
|
||||||
|
import org.opencv.features2d.DMatch;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
public class DMatchTest extends TestCase {
|
public class DMatchTest extends TestCase {
|
||||||
|
|
||||||
public void testDMatch() {
|
public void testDMatch() {
|
||||||
fail("Not yet implemented");
|
new DMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDMatchIntIntFloat() {
|
public void testDMatchIntIntFloat() {
|
||||||
fail("Not yet implemented");
|
DMatch dm1 = new DMatch(1, 4, 4.0f);
|
||||||
|
|
||||||
|
assertEquals(1, dm1.queryIdx);
|
||||||
|
assertEquals(4, dm1.trainIdx);
|
||||||
|
assertEquals(4.0f, dm1.distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDMatchIntIntIntFloat() {
|
public void testDMatchIntIntIntFloat() {
|
||||||
fail("Not yet implemented");
|
DMatch dm2 = new DMatch(2, 6, -1, 8.0f);
|
||||||
|
|
||||||
|
assertEquals(2, dm2.queryIdx);
|
||||||
|
assertEquals(6, dm2.trainIdx);
|
||||||
|
assertEquals(-1, dm2.imgIdx);
|
||||||
|
assertEquals(8.0f, dm2.distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLessThan() {
|
public void testLessThan() {
|
||||||
fail("Not yet implemented");
|
DMatch dm1 = new DMatch(1, 4, 4.0f);
|
||||||
|
DMatch dm2 = new DMatch(2, 6, -1, 8.0f);
|
||||||
|
assertTrue(dm1.lessThan(dm2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testToString() {
|
public void testToString() {
|
||||||
fail("Not yet implemented");
|
DMatch dm2 = new DMatch(2, 6, -1, 8.0f);
|
||||||
|
|
||||||
|
String actual = dm2.toString();
|
||||||
|
|
||||||
|
String expected = "DMatch [queryIdx=2, trainIdx=6, imgIdx=-1, distance=8.0]";
|
||||||
|
assertEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.opencv.test.features2d;
|
package org.opencv.test.features2d;
|
||||||
|
|
||||||
|
import org.opencv.core.Point;
|
||||||
import org.opencv.features2d.KeyPoint;
|
import org.opencv.features2d.KeyPoint;
|
||||||
import org.opencv.test.OpenCVTestCase;
|
import org.opencv.test.OpenCVTestCase;
|
||||||
|
|
||||||
@ -9,6 +10,10 @@ public class KeyPointTest extends OpenCVTestCase {
|
|||||||
private float size;
|
private float size;
|
||||||
private float x;
|
private float x;
|
||||||
private float y;
|
private float y;
|
||||||
|
private float angle;
|
||||||
|
private float response;
|
||||||
|
private int octave;
|
||||||
|
private int classId;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
@ -18,88 +23,104 @@ public class KeyPointTest extends OpenCVTestCase {
|
|||||||
x = 1.0f;
|
x = 1.0f;
|
||||||
y = 2.0f;
|
y = 2.0f;
|
||||||
size = 3.0f;
|
size = 3.0f;
|
||||||
|
angle = 30.0f;
|
||||||
|
response = 2.0f;
|
||||||
|
octave = 1;
|
||||||
|
classId = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGet_angle() {
|
public void testGet_angle() {
|
||||||
fail("Not yet implemented");
|
keyPoint = new KeyPoint(x, y, size, angle);
|
||||||
|
assertEquals(30.0f, keyPoint.angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGet_class_id() {
|
public void testGet_class_id() {
|
||||||
fail("Not yet implemented");
|
keyPoint = new KeyPoint(x, y, size, angle, response, octave, classId);
|
||||||
|
assertEquals(1, keyPoint.class_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGet_octave() {
|
public void testGet_octave() {
|
||||||
fail("Not yet implemented");
|
keyPoint = new KeyPoint(x, y, size, angle, response, octave);
|
||||||
|
assertEquals(1, keyPoint.octave);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGet_pt() {
|
public void testGet_pt() {
|
||||||
fail("Not yet implemented");
|
keyPoint = new KeyPoint(x, y, size);
|
||||||
|
assertPointEquals(new Point(1, 2), keyPoint.pt, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGet_response() {
|
public void testGet_response() {
|
||||||
fail("Not yet implemented");
|
keyPoint = new KeyPoint(x, y, size, angle, response);
|
||||||
|
assertEquals(2.0f, keyPoint.response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGet_size() {
|
public void testGet_size() {
|
||||||
fail("Not yet implemented");
|
keyPoint = new KeyPoint(x, y, size);
|
||||||
|
assertEquals(3.0f, keyPoint.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testKeyPoint() {
|
public void testKeyPoint() {
|
||||||
keyPoint = new KeyPoint();
|
keyPoint = new KeyPoint();
|
||||||
assertTrue(null != keyPoint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testKeyPointFloatFloatFloat() {
|
public void testKeyPointFloatFloatFloat() {
|
||||||
keyPoint = new KeyPoint(x, y, size);
|
keyPoint = new KeyPoint(x, y, size);
|
||||||
assertTrue(null != keyPoint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testKeyPointFloatFloatFloatFloat() {
|
public void testKeyPointFloatFloatFloatFloat() {
|
||||||
keyPoint = new KeyPoint(x, y, size, 10.0f);
|
keyPoint = new KeyPoint(x, y, size, 10.0f);
|
||||||
assertTrue(null != keyPoint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testKeyPointFloatFloatFloatFloatFloat() {
|
public void testKeyPointFloatFloatFloatFloatFloat() {
|
||||||
keyPoint = new KeyPoint(x, y, size, 1.0f, 1.0f);
|
keyPoint = new KeyPoint(x, y, size, 1.0f, 1.0f);
|
||||||
assertTrue(null != keyPoint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testKeyPointFloatFloatFloatFloatFloatInt() {
|
public void testKeyPointFloatFloatFloatFloatFloatInt() {
|
||||||
keyPoint = new KeyPoint(x, y, size, 1.0f, 1.0f, 1);
|
keyPoint = new KeyPoint(x, y, size, 1.0f, 1.0f, 1);
|
||||||
assertTrue(null != keyPoint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testKeyPointFloatFloatFloatFloatFloatIntInt() {
|
public void testKeyPointFloatFloatFloatFloatFloatIntInt() {
|
||||||
keyPoint = new KeyPoint(x, y, size, 1.0f, 1.0f, 1, 1);
|
keyPoint = new KeyPoint(x, y, size, 1.0f, 1.0f, 1, 1);
|
||||||
assertTrue(null != keyPoint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSet_angle() {
|
public void testSet_angle() {
|
||||||
fail("Not yet implemented");
|
keyPoint = new KeyPoint(x, y, size, angle);
|
||||||
|
keyPoint.angle = 10f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSet_class_id() {
|
public void testSet_class_id() {
|
||||||
fail("Not yet implemented");
|
keyPoint = new KeyPoint(x, y, size, angle, response, octave, classId);
|
||||||
|
keyPoint.class_id = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSet_octave() {
|
public void testSet_octave() {
|
||||||
fail("Not yet implemented");
|
keyPoint = new KeyPoint(x, y, size, angle, response, octave);
|
||||||
|
keyPoint.octave = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSet_pt() {
|
public void testSet_pt() {
|
||||||
fail("Not yet implemented");
|
keyPoint = new KeyPoint(x, y, size);
|
||||||
|
keyPoint.pt = new Point(4, 3);
|
||||||
|
assertPointEquals(new Point(4, 3), keyPoint.pt, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSet_response() {
|
public void testSet_response() {
|
||||||
fail("Not yet implemented");
|
keyPoint = new KeyPoint(x, y, size, angle, response);
|
||||||
|
keyPoint.response = 1.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSet_size() {
|
public void testSet_size() {
|
||||||
fail("Not yet implemented");
|
keyPoint = new KeyPoint(x, y, size);
|
||||||
|
keyPoint.size = 5.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testToString() {
|
public void testToString() {
|
||||||
fail("Not yet implemented");
|
keyPoint = new KeyPoint(x, y, size, angle, response, octave, classId);
|
||||||
|
|
||||||
|
String actual = keyPoint.toString();
|
||||||
|
|
||||||
|
String expected = "KeyPoint [pt={1.0, 2.0}, size=3.0, angle=30.0, response=2.0, octave=1, class_id=1]";
|
||||||
|
assertEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,52 @@
|
|||||||
package org.opencv.test.utils;
|
package org.opencv.test.utils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.opencv.core.CvType;
|
import org.opencv.core.CvType;
|
||||||
import org.opencv.core.Mat;
|
import org.opencv.core.Mat;
|
||||||
import org.opencv.core.Point;
|
import org.opencv.core.Point;
|
||||||
|
import org.opencv.core.Point3;
|
||||||
import org.opencv.core.Rect;
|
import org.opencv.core.Rect;
|
||||||
|
import org.opencv.features2d.DMatch;
|
||||||
import org.opencv.features2d.KeyPoint;
|
import org.opencv.features2d.KeyPoint;
|
||||||
import org.opencv.test.OpenCVTestCase;
|
import org.opencv.test.OpenCVTestCase;
|
||||||
|
import org.opencv.test.OpenCVTestRunner;
|
||||||
import org.opencv.utils.Converters;
|
import org.opencv.utils.Converters;
|
||||||
|
|
||||||
public class ConvertersTest extends OpenCVTestCase {
|
public class ConvertersTest extends OpenCVTestCase {
|
||||||
|
|
||||||
public void testMat_to_vector_char() {
|
public void testMat_to_vector_char() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(3, 1, CvType.CV_8SC1);
|
||||||
|
src.put(0, 0, 2, 4, 3);
|
||||||
|
List<Byte> bs = new ArrayList<Byte>();
|
||||||
|
|
||||||
|
Converters.Mat_to_vector_char(src, bs);
|
||||||
|
|
||||||
|
List<Byte> truth = new ArrayList<Byte>();
|
||||||
|
byte value1 = 2;
|
||||||
|
byte value2 = 4;
|
||||||
|
byte value3 = 3;
|
||||||
|
truth.add(new Byte(value1));
|
||||||
|
truth.add(new Byte(value2));
|
||||||
|
truth.add(new Byte(value3));
|
||||||
|
assertEquals(truth, bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMat_to_vector_DMatch() {
|
public void testMat_to_vector_DMatch() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(4, 1, CvType.CV_64FC4);
|
||||||
|
src.put(0, 0, 1, 4, 4, 10, 2, 3, 5, 6, 3, 1, 8, 12, 4, 9, 5, 15);
|
||||||
|
List<DMatch> matches = new ArrayList<DMatch>();
|
||||||
|
|
||||||
|
Converters.Mat_to_vector_DMatch(src, matches);
|
||||||
|
|
||||||
|
List<DMatch> truth = new ArrayList<DMatch>();
|
||||||
|
truth.add(new DMatch(1, 4, 4, 10));
|
||||||
|
truth.add(new DMatch(2, 3, 5, 6));
|
||||||
|
truth.add(new DMatch(3, 1, 8, 12));
|
||||||
|
truth.add(new DMatch(4, 9, 5, 15));
|
||||||
|
assertListDMatchEquals(truth, matches, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMat_to_vector_float() {
|
public void testMat_to_vector_float() {
|
||||||
@ -27,6 +55,7 @@ public class ConvertersTest extends OpenCVTestCase {
|
|||||||
List<Float> fs = new ArrayList<Float>();
|
List<Float> fs = new ArrayList<Float>();
|
||||||
|
|
||||||
Converters.Mat_to_vector_float(src, fs);
|
Converters.Mat_to_vector_float(src, fs);
|
||||||
|
|
||||||
List<Float> truth = new ArrayList<Float>();
|
List<Float> truth = new ArrayList<Float>();
|
||||||
truth.add(2.0f);
|
truth.add(2.0f);
|
||||||
truth.add(4.0f);
|
truth.add(4.0f);
|
||||||
@ -55,6 +84,7 @@ public class ConvertersTest extends OpenCVTestCase {
|
|||||||
List<KeyPoint> kps = new ArrayList<KeyPoint>();
|
List<KeyPoint> kps = new ArrayList<KeyPoint>();
|
||||||
|
|
||||||
Converters.Mat_to_vector_KeyPoint(src, kps);
|
Converters.Mat_to_vector_KeyPoint(src, kps);
|
||||||
|
|
||||||
List<KeyPoint> truth = new ArrayList<KeyPoint>();
|
List<KeyPoint> truth = new ArrayList<KeyPoint>();
|
||||||
truth.add(new KeyPoint(2, 4, 3, 9, 10, 12, 7));
|
truth.add(new KeyPoint(2, 4, 3, 9, 10, 12, 7));
|
||||||
assertListKeyPointEquals(truth, kps, EPS);
|
assertListKeyPointEquals(truth, kps, EPS);
|
||||||
@ -82,6 +112,7 @@ public class ConvertersTest extends OpenCVTestCase {
|
|||||||
List<Point> points = new ArrayList<Point>();
|
List<Point> points = new ArrayList<Point>();
|
||||||
|
|
||||||
Converters.Mat_to_vector_Point(src, points);
|
Converters.Mat_to_vector_Point(src, points);
|
||||||
|
|
||||||
List<Point> truth = new ArrayList<Point>();
|
List<Point> truth = new ArrayList<Point>();
|
||||||
truth.add(new Point(2, 4));
|
truth.add(new Point(2, 4));
|
||||||
truth.add(new Point(3, 9));
|
truth.add(new Point(3, 9));
|
||||||
@ -91,27 +122,93 @@ public class ConvertersTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testMat_to_vector_Point2d() {
|
public void testMat_to_vector_Point2d() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(4, 1, CvType.CV_64FC2);
|
||||||
|
src.put(0, 0, 12.0, 4.0, 3.0, 29.0, 10.0, 24.0, 35.0, 54.0);
|
||||||
|
List<Point> points = new ArrayList<Point>();
|
||||||
|
|
||||||
|
Converters.Mat_to_vector_Point2d(src, points);
|
||||||
|
|
||||||
|
List<Point> truth = new ArrayList<Point>();
|
||||||
|
truth.add(new Point(12.0, 4.0));
|
||||||
|
truth.add(new Point(3.0, 29.0));
|
||||||
|
truth.add(new Point(10.0, 24.0));
|
||||||
|
truth.add(new Point(35.0, 54.0));
|
||||||
|
assertListPointEquals(truth, points, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMat_to_vector_Point2f() {
|
public void testMat_to_vector_Point2f() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(4, 1, CvType.CV_32FC2);
|
||||||
|
src.put(0, 0, 2, 14, 31, 19, 10, 44, 5, 41);
|
||||||
|
List<Point> points = new ArrayList<Point>();
|
||||||
|
|
||||||
|
Converters.Mat_to_vector_Point(src, points);
|
||||||
|
|
||||||
|
List<Point> truth = new ArrayList<Point>();
|
||||||
|
truth.add(new Point(2, 14));
|
||||||
|
truth.add(new Point(31, 19));
|
||||||
|
truth.add(new Point(10, 44));
|
||||||
|
truth.add(new Point(5, 41));
|
||||||
|
assertListPointEquals(truth, points, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMat_to_vector_Point3() {
|
public void testMat_to_vector_Point3() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(4, 1, CvType.CV_32SC3);
|
||||||
|
src.put(0, 0, 2, 14, 12, 31, 19, 22, 10, 44, 45, 5, 41, 31);
|
||||||
|
List<Point3> points = new ArrayList<Point3>();
|
||||||
|
|
||||||
|
Converters.Mat_to_vector_Point3(src, points);
|
||||||
|
|
||||||
|
List<Point3> truth = new ArrayList<Point3>();
|
||||||
|
truth.add(new Point3(2, 14, 12));
|
||||||
|
truth.add(new Point3(31, 19, 22));
|
||||||
|
truth.add(new Point3(10, 44, 45));
|
||||||
|
truth.add(new Point3(5, 41, 31));
|
||||||
|
assertListPoint3Equals(truth, points, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMat_to_vector_Point3d() {
|
public void testMat_to_vector_Point3d() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(4, 1, CvType.CV_64FC3);
|
||||||
|
src.put(0, 0, 2.0, 4.0, 3.0, 5.0, 9.0, 12.0, 10.0, 14.0, 15.0, 5.0, 11.0, 31.0);
|
||||||
|
List<Point3> points = new ArrayList<Point3>();
|
||||||
|
|
||||||
|
Converters.Mat_to_vector_Point3(src, points);
|
||||||
|
|
||||||
|
List<Point3> truth = new ArrayList<Point3>();
|
||||||
|
truth.add(new Point3(2.0, 4.0, 3.0));
|
||||||
|
truth.add(new Point3(5.0, 9.0, 12.0));
|
||||||
|
truth.add(new Point3(10.0, 14.0, 15.0));
|
||||||
|
truth.add(new Point3(5.0, 11.0, 31.0));
|
||||||
|
assertListPoint3Equals(truth, points, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMat_to_vector_Point3f() {
|
public void testMat_to_vector_Point3f() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(4, 1, CvType.CV_32FC3);
|
||||||
|
src.put(0, 0, 2.0, 4.0, 3.0, 5.0, 9.0, 12.0, 10.0, 14.0, 15.0, 5.0, 11.0, 31.0);
|
||||||
|
List<Point3> points = new ArrayList<Point3>();
|
||||||
|
|
||||||
|
Converters.Mat_to_vector_Point3(src, points);
|
||||||
|
|
||||||
|
List<Point3> truth = new ArrayList<Point3>();
|
||||||
|
truth.add(new Point3(2.0, 4.0, 3.0));
|
||||||
|
truth.add(new Point3(5.0, 9.0, 12.0));
|
||||||
|
truth.add(new Point3(10.0, 14.0, 15.0));
|
||||||
|
truth.add(new Point3(5.0, 11.0, 31.0));
|
||||||
|
assertListPoint3Equals(truth, points, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMat_to_vector_Point3i() {
|
public void testMat_to_vector_Point3i() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(4, 1, CvType.CV_32SC3);
|
||||||
|
src.put(0, 0, 2, 14, 12, 31, 19, 22, 10, 44, 45, 5, 41, 31);
|
||||||
|
List<Point3> points = new ArrayList<Point3>();
|
||||||
|
|
||||||
|
Converters.Mat_to_vector_Point3(src, points);
|
||||||
|
|
||||||
|
List<Point3> truth = new ArrayList<Point3>();
|
||||||
|
truth.add(new Point3(2, 14, 12));
|
||||||
|
truth.add(new Point3(31, 19, 22));
|
||||||
|
truth.add(new Point3(10, 44, 45));
|
||||||
|
truth.add(new Point3(5, 41, 31));
|
||||||
|
assertListPoint3Equals(truth, points, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMat_to_vector_Rect() {
|
public void testMat_to_vector_Rect() {
|
||||||
@ -127,7 +224,20 @@ public class ConvertersTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testMat_to_vector_uchar() {
|
public void testMat_to_vector_uchar() {
|
||||||
fail("Not yet implemented");
|
Mat src = new Mat(3, 1, CvType.CV_8UC1);
|
||||||
|
src.put(0, 0, 2, 4, 3);
|
||||||
|
List<Byte> bs = new ArrayList<Byte>();
|
||||||
|
|
||||||
|
Converters.Mat_to_vector_uchar(src, bs);
|
||||||
|
|
||||||
|
List<Byte> truth = new ArrayList<Byte>();
|
||||||
|
byte value1 = 2;
|
||||||
|
byte value2 = 4;
|
||||||
|
byte value3 = 3;
|
||||||
|
truth.add(new Byte(value1));
|
||||||
|
truth.add(new Byte(value2));
|
||||||
|
truth.add(new Byte(value3));
|
||||||
|
assertEquals(truth, bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMat_to_vector_vector_char() {
|
public void testMat_to_vector_vector_char() {
|
||||||
@ -143,11 +253,35 @@ public class ConvertersTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testVector_char_to_Mat() {
|
public void testVector_char_to_Mat() {
|
||||||
fail("Not yet implemented");
|
List<Byte> bytes = new ArrayList<Byte>();
|
||||||
|
byte value1 = 1;
|
||||||
|
byte value2 = 2;
|
||||||
|
byte value3 = 3;
|
||||||
|
byte value4 = 4;
|
||||||
|
bytes.add(new Byte(value1));
|
||||||
|
bytes.add(new Byte(value2));
|
||||||
|
bytes.add(new Byte(value3));
|
||||||
|
bytes.add(new Byte(value4));
|
||||||
|
|
||||||
|
dst = Converters.vector_char_to_Mat(bytes);
|
||||||
|
truth = new Mat(4, 1, CvType.CV_8SC1);
|
||||||
|
truth.put(0, 0, 1, 2, 3, 4);
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testVector_DMatch_to_Mat() {
|
public void testVector_DMatch_to_Mat() {
|
||||||
fail("Not yet implemented");
|
List<DMatch> matches = new ArrayList<DMatch>();
|
||||||
|
matches.add(new DMatch(1, 4, 4, 10));
|
||||||
|
matches.add(new DMatch(2, 3, 5, 6));
|
||||||
|
matches.add(new DMatch(3, 1, 8, 12));
|
||||||
|
matches.add(new DMatch(4, 9, 5, 15));
|
||||||
|
|
||||||
|
dst = Converters.vector_DMatch_to_Mat(matches);
|
||||||
|
|
||||||
|
Mat truth = new Mat(4, 1, CvType.CV_64FC4);
|
||||||
|
truth.put(0, 0, 1, 4, 4, 10, 2, 3, 5, 6, 3, 1, 8, 12, 4, 9, 5, 15);
|
||||||
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testVector_double_to_Mat() {
|
public void testVector_double_to_Mat() {
|
||||||
@ -190,7 +324,15 @@ public class ConvertersTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testVector_KeyPoint_to_Mat() {
|
public void testVector_KeyPoint_to_Mat() {
|
||||||
fail("Not yet implemented");
|
List<KeyPoint> kps = new ArrayList<KeyPoint>();
|
||||||
|
kps.add(new KeyPoint(2, 4, 3, 9, 10, 12, 7));
|
||||||
|
|
||||||
|
dst = Converters.vector_KeyPoint_to_Mat(kps);
|
||||||
|
|
||||||
|
Mat truth = new Mat(1, 1, CvType.CV_64FC(7));
|
||||||
|
truth.put(0, 0, 2, 4, 3, 9, 10, 12, 7);
|
||||||
|
|
||||||
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testVector_Mat_to_Mat() {
|
public void testVector_Mat_to_Mat() {
|
||||||
@ -214,6 +356,7 @@ public class ConvertersTest extends OpenCVTestCase {
|
|||||||
points.add(new Point(35, 54));
|
points.add(new Point(35, 54));
|
||||||
|
|
||||||
dst = Converters.vector_Point_to_Mat(points);
|
dst = Converters.vector_Point_to_Mat(points);
|
||||||
|
|
||||||
truth = new Mat(4, 1, CvType.CV_32SC2);
|
truth = new Mat(4, 1, CvType.CV_32SC2);
|
||||||
truth.put(0, 0, 2, 4, 3, 9, 10, 4, 35, 54);
|
truth.put(0, 0, 2, 4, 3, 9, 10, 4, 35, 54);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst);
|
||||||
@ -228,27 +371,83 @@ public class ConvertersTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testVector_Point2d_to_Mat() {
|
public void testVector_Point2d_to_Mat() {
|
||||||
fail("Not yet implemented");
|
List<Point> points = new ArrayList<Point>();
|
||||||
|
points.add(new Point(12.0, 4.0));
|
||||||
|
points.add(new Point(3.0, 9.0));
|
||||||
|
points.add(new Point(1.0, 2.0));
|
||||||
|
|
||||||
|
dst = Converters.vector_Point2d_to_Mat(points);
|
||||||
|
|
||||||
|
truth = new Mat(3, 1, CvType.CV_64FC2);
|
||||||
|
truth.put(0, 0, 12.0, 4.0, 3.0, 9.0, 1.0, 2.0);
|
||||||
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testVector_Point2f_to_Mat() {
|
public void testVector_Point2f_to_Mat() {
|
||||||
fail("Not yet implemented");
|
List<Point> points = new ArrayList<Point>();
|
||||||
|
points.add(new Point(2.0, 3.0));
|
||||||
|
points.add(new Point(1.0, 2.0));
|
||||||
|
points.add(new Point(1.0, 4.0));
|
||||||
|
|
||||||
|
dst = Converters.vector_Point2f_to_Mat(points);
|
||||||
|
|
||||||
|
truth = new Mat(3, 1, CvType.CV_32FC2);
|
||||||
|
truth.put(0, 0, 2.0, 3.0, 1.0, 2.0, 1.0, 4.0);
|
||||||
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testVector_Point3_to_Mat() {
|
public void testVector_Point3_to_Mat() {
|
||||||
fail("Not yet implemented");
|
List<Point3> points = new ArrayList<Point3>();
|
||||||
|
points.add(new Point3(2, 4, 3));
|
||||||
|
points.add(new Point3(5, 9, 12));
|
||||||
|
points.add(new Point3(10, 14, 15));
|
||||||
|
points.add(new Point3(5, 11, 31));
|
||||||
|
|
||||||
|
dst = Converters.vector_Point3_to_Mat(points, CvType.CV_32S);
|
||||||
|
truth = new Mat(4, 1, CvType.CV_32SC3);
|
||||||
|
truth.put(0, 0, 2.0, 4.0, 3.0, 5.0, 9.0, 12.0, 10.0, 14.0, 15.0, 5.0, 11.0, 31.0);
|
||||||
|
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testVector_Point3d_to_Mat() {
|
public void testVector_Point3d_to_Mat() {
|
||||||
fail("Not yet implemented");
|
List<Point3> points = new ArrayList<Point3>();
|
||||||
|
points.add(new Point3(2.0, 4.0, 3.0));
|
||||||
|
points.add(new Point3(5.0, 9.0, 12.0));
|
||||||
|
points.add(new Point3(10.0, 14.0, 15.0));
|
||||||
|
points.add(new Point3(5.0, 11.0, 31.0));
|
||||||
|
|
||||||
|
dst = Converters.vector_Point3d_to_Mat(points);
|
||||||
|
truth = new Mat(4, 1, CvType.CV_64FC3);
|
||||||
|
truth.put(0, 0, 2.0, 4.0, 3.0, 5.0, 9.0, 12.0, 10.0, 14.0, 15.0, 5.0, 11.0, 31.0);
|
||||||
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testVector_Point3f_to_Mat() {
|
public void testVector_Point3f_to_Mat() {
|
||||||
fail("Not yet implemented");
|
List<Point3> points = new ArrayList<Point3>();
|
||||||
|
points.add(new Point3(2.0, 4.0, 3.0));
|
||||||
|
points.add(new Point3(5.0, 9.0, 12.0));
|
||||||
|
points.add(new Point3(10.0, 14.0, 15.0));
|
||||||
|
points.add(new Point3(5.0, 11.0, 31.0));
|
||||||
|
|
||||||
|
dst = Converters.vector_Point3f_to_Mat(points);
|
||||||
|
truth = new Mat(4, 1, CvType.CV_32FC3);
|
||||||
|
truth.put(0, 0, 2.0, 4.0, 3.0, 5.0, 9.0, 12.0, 10.0, 14.0, 15.0, 5.0, 11.0, 31.0);
|
||||||
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testVector_Point3i_to_Mat() {
|
public void testVector_Point3i_to_Mat() {
|
||||||
fail("Not yet implemented");
|
List<Point3> points = new ArrayList<Point3>();
|
||||||
|
points.add(new Point3(2, 4, 3));
|
||||||
|
points.add(new Point3(5, 6, 2));
|
||||||
|
points.add(new Point3(0, 4, 5));
|
||||||
|
points.add(new Point3(5, 1, 3));
|
||||||
|
|
||||||
|
dst = Converters.vector_Point3i_to_Mat(points);
|
||||||
|
|
||||||
|
truth = new Mat(4, 1, CvType.CV_32SC3);
|
||||||
|
truth.put(0, 0, 2, 4, 3, 5, 6, 2, 0, 4, 5, 5, 1, 3);
|
||||||
|
assertMatEqual(truth, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testVector_Rect_to_Mat() {
|
public void testVector_Rect_to_Mat() {
|
||||||
@ -257,6 +456,7 @@ public class ConvertersTest extends OpenCVTestCase {
|
|||||||
rectangles.add(new Rect(0, 0, 6, 4));
|
rectangles.add(new Rect(0, 0, 6, 4));
|
||||||
|
|
||||||
dst = Converters.vector_Rect_to_Mat(rectangles);
|
dst = Converters.vector_Rect_to_Mat(rectangles);
|
||||||
|
|
||||||
truth = new Mat(2, 1, CvType.CV_32SC4);
|
truth = new Mat(2, 1, CvType.CV_32SC4);
|
||||||
truth.put(0, 0, 2, 2, 5, 2, 0, 0, 6, 4);
|
truth.put(0, 0, 2, 2, 5, 2, 0, 0, 6, 4);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst);
|
||||||
@ -281,6 +481,17 @@ public class ConvertersTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
public void testVector_vector_char_to_Mat() {
|
public void testVector_vector_char_to_Mat() {
|
||||||
fail("Not yet implemented");
|
fail("Not yet implemented");
|
||||||
|
List<List<Byte>> llb = new ArrayList<List<Byte>>();
|
||||||
|
byte value1 = 1;
|
||||||
|
byte value2 = 2;
|
||||||
|
byte value3 = 3;
|
||||||
|
byte value4 = 4;
|
||||||
|
llb.add(Arrays.asList(new Byte(value1), new Byte(value2), new Byte(value3), new Byte(value4)));
|
||||||
|
|
||||||
|
dst = Converters.vector_vector_char_to_Mat(llb);
|
||||||
|
|
||||||
|
OpenCVTestRunner.Log(dst.toString());
|
||||||
|
OpenCVTestRunner.Log(dst.dump());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testVector_vector_DMatch_to_Mat() {
|
public void testVector_vector_DMatch_to_Mat() {
|
||||||
@ -292,7 +503,15 @@ public class ConvertersTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testVector_vector_Point_to_Mat() {
|
public void testVector_vector_Point_to_Mat() {
|
||||||
|
List<List<Point>> points = new ArrayList<List<Point>>();
|
||||||
|
points.add(Arrays.asList(new Point(1, 1), new Point(7, 1), new Point(7, 6), new Point(1, 6),
|
||||||
|
new Point(5, 5), new Point(8, 9)));
|
||||||
|
|
||||||
|
dst = Converters.vector_vector_Point_to_Mat(points);
|
||||||
|
// TODO: returns random dst matrix
|
||||||
|
// assertMatEqual();
|
||||||
fail("Not yet implemented");
|
fail("Not yet implemented");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,35 @@
|
|||||||
package org.opencv.test.video;
|
package org.opencv.test.video;
|
||||||
|
|
||||||
|
import org.opencv.core.Core;
|
||||||
|
import org.opencv.core.CvType;
|
||||||
|
import org.opencv.core.Mat;
|
||||||
|
import org.opencv.core.Point;
|
||||||
|
import org.opencv.core.Scalar;
|
||||||
|
import org.opencv.highgui.Highgui;
|
||||||
import org.opencv.test.OpenCVTestCase;
|
import org.opencv.test.OpenCVTestCase;
|
||||||
|
import org.opencv.video.BackgroundSubtractorMOG;
|
||||||
|
|
||||||
public class BackgroundSubtractorMOGTest extends OpenCVTestCase {
|
public class BackgroundSubtractorMOGTest extends OpenCVTestCase {
|
||||||
|
|
||||||
public void testApplyMatMat() {
|
public void testApplyMatMat() {
|
||||||
fail("Not yet implemented");
|
fail("Not yet implemented");
|
||||||
|
BackgroundSubtractorMOG backGroundSubtract = new BackgroundSubtractorMOG();
|
||||||
|
|
||||||
|
Point bottomRight = new Point(rgbLena.cols() / 2, rgbLena.rows() / 2);
|
||||||
|
Point topLeft = new Point(0, 0);
|
||||||
|
Scalar color = new Scalar(128);
|
||||||
|
Mat mask = new Mat(rgbLena.size(), CvType.CV_16UC3, new Scalar(1));
|
||||||
|
|
||||||
|
Core.rectangle(rgbLena, bottomRight, topLeft, color, Core.FILLED);
|
||||||
|
|
||||||
|
backGroundSubtract.apply(rgbLena, mask);
|
||||||
|
|
||||||
|
Mat truth = new Mat(rgbLena.size(), rgbLena.type(), new Scalar(0));
|
||||||
|
Core.rectangle(truth, bottomRight, topLeft, color, Core.FILLED);
|
||||||
|
// OpenCVTestRunner.Log(dst.dump());
|
||||||
|
// OpenCVTestRunner.Log(rgbLena.dump());
|
||||||
|
Highgui.imwrite("/mnt/sdcard/lena1.png", rgbLena);
|
||||||
|
assertMatEqual(truth, rgbLena);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testApplyMatMatDouble() {
|
public void testApplyMatMatDouble() {
|
||||||
|
@ -65,7 +65,7 @@ class JavaParser:
|
|||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
if path.endswith("FeatureDetector.java"):
|
if path.endswith("FeatureDetector.java"):
|
||||||
for prefix1 in ("", "Grid", "Pyramid", "Dynamic"):
|
for prefix1 in ("", "Grid", "Pyramid", "Dynamic"):
|
||||||
for prefix2 in ("FAST", "STAR", "MSER", "ORB", "SIFT", "SURF", "GFTT", "HARRIS"):
|
for prefix2 in ("FAST", "STAR", "MSER", "ORB", "SIFT", "SURF", "GFTT", "HARRIS", "SIMPLEBLOB", "DENSE"):
|
||||||
parser.parse_file(path,prefix1+prefix2)
|
parser.parse_file(path,prefix1+prefix2)
|
||||||
elif path.endswith("DescriptorExtractor.java"):
|
elif path.endswith("DescriptorExtractor.java"):
|
||||||
for prefix1 in ("", "Opponent"):
|
for prefix1 in ("", "Opponent"):
|
||||||
|
@ -206,11 +206,14 @@ type_dict = {
|
|||||||
"vector_int" : { "j_type" : "List<Integer>", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector<int> %(n)s", "suffix" : "J" },
|
"vector_int" : { "j_type" : "List<Integer>", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector<int> %(n)s", "suffix" : "J" },
|
||||||
"vector_float" : { "j_type" : "List<Float>", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector<float> %(n)s", "suffix" : "J" },
|
"vector_float" : { "j_type" : "List<Float>", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector<float> %(n)s", "suffix" : "J" },
|
||||||
"vector_double" : { "j_type" : "List<Double>", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector<double> %(n)s", "suffix" : "J" },
|
"vector_double" : { "j_type" : "List<Double>", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector<double> %(n)s", "suffix" : "J" },
|
||||||
|
"vector_Vec4f" : { "j_type" : "Mat", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector<Vec4f> %(n)s", "suffix" : "J" },
|
||||||
|
"vector_Vec6f" : { "j_type" : "Mat", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector<Vec6f> %(n)s", "suffix" : "J" },
|
||||||
|
|
||||||
"vector_vector_KeyPoint": { "j_type" : "List<List<KeyPoint>>", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector< vector<KeyPoint> > %(n)s" },
|
"vector_vector_KeyPoint": { "j_type" : "List<List<KeyPoint>>", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector< vector<KeyPoint> > %(n)s" },
|
||||||
"vector_vector_DMatch" : { "j_type" : "List<List<DMatch>>", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector< vector<DMatch> > %(n)s" },
|
"vector_vector_DMatch" : { "j_type" : "List<List<DMatch>>", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector< vector<DMatch> > %(n)s" },
|
||||||
"vector_vector_char" : { "j_type" : "List<List<Byte>>", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector< vector<char> > %(n)s" },
|
"vector_vector_char" : { "j_type" : "List<List<Byte>>", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector< vector<char> > %(n)s" },
|
||||||
"vector_vector_Point" : { "j_type" : "List<List<Point>>", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector< vector<Point> > %(n)s" },
|
"vector_vector_Point" : { "j_type" : "List<List<Point>>", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector< vector<Point> > %(n)s" },
|
||||||
|
"vector_vector_Point2f" : { "j_type" : "List<List<Point>>", "jn_type" : "long", "jni_type" : "jlong", "jni_var" : "vector< vector<Point2f> > %(n)s" },
|
||||||
|
|
||||||
"Mat" : { "j_type" : "Mat", "jn_type" : "long", "jn_args" : (("__int64", ".nativeObj"),),
|
"Mat" : { "j_type" : "Mat", "jn_type" : "long", "jn_args" : (("__int64", ".nativeObj"),),
|
||||||
"jni_var" : "Mat& %(n)s = *((Mat*)%(n)s_nativeObj)",
|
"jni_var" : "Mat& %(n)s = *((Mat*)%(n)s_nativeObj)",
|
||||||
@ -1139,7 +1142,8 @@ extern "C" {
|
|||||||
else:
|
else:
|
||||||
j_prologue.append( "Mat %s_mat = new Mat();" % a.name )
|
j_prologue.append( "Mat %s_mat = new Mat();" % a.name )
|
||||||
if "O" in a.out:
|
if "O" in a.out:
|
||||||
j_epilogue.append("Converters.Mat_to_%(t)s(%(n)s_mat, %(n)s);" % {"t" : a.ctype, "n" : a.name})
|
if type_dict[a.ctype]["j_type"] != "Mat":
|
||||||
|
j_epilogue.append("Converters.Mat_to_%(t)s(%(n)s_mat, %(n)s);" % {"t" : a.ctype, "n" : a.name})
|
||||||
c_epilogue.append( "%(t)s_to_Mat( %(n)s, %(n)s_mat );" % {"n" : a.name, "t" : a.ctype} )
|
c_epilogue.append( "%(t)s_to_Mat( %(n)s, %(n)s_mat );" % {"n" : a.name, "t" : a.ctype} )
|
||||||
else:
|
else:
|
||||||
fields = type_dict[a.ctype].get("jn_args", ((a.ctype, ""),))
|
fields = type_dict[a.ctype].get("jn_args", ((a.ctype, ""),))
|
||||||
|
@ -354,3 +354,26 @@ void vector_vector_char_to_Mat(vector< vector< char > >& vv_ch, Mat& mat)
|
|||||||
}
|
}
|
||||||
vector_Mat_to_Mat(vm, mat);
|
vector_Mat_to_Mat(vm, mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vector_vector_Point2f_to_Mat(vector< vector< Point2f > >& vv_pt, Mat& mat)
|
||||||
|
{
|
||||||
|
vector<Mat> vm;
|
||||||
|
vm.reserve( vv_pt.size() );
|
||||||
|
for(size_t i=0; i<vv_pt.size(); i++)
|
||||||
|
{
|
||||||
|
Mat m;
|
||||||
|
vector_Point2f_to_Mat(vv_pt[i], m);
|
||||||
|
vm.push_back(m);
|
||||||
|
}
|
||||||
|
vector_Mat_to_Mat(vm, mat);
|
||||||
|
}
|
||||||
|
|
||||||
|
void vector_Vec4f_to_Mat(vector<Vec4f>& v_vec, Mat& mat)
|
||||||
|
{
|
||||||
|
mat = Mat(v_vec, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void vector_Vec6f_to_Mat(vector<Vec6f>& v_vec, Mat& mat)
|
||||||
|
{
|
||||||
|
mat = Mat(v_vec, true);
|
||||||
|
}
|
||||||
|
@ -38,6 +38,9 @@ void vector_Point3i_to_Mat(std::vector<cv::Point3i>& v_point, cv::Mat& mat);
|
|||||||
void vector_Point3f_to_Mat(std::vector<cv::Point3f>& v_point, cv::Mat& mat);
|
void vector_Point3f_to_Mat(std::vector<cv::Point3f>& v_point, cv::Mat& mat);
|
||||||
void vector_Point3d_to_Mat(std::vector<cv::Point3d>& v_point, cv::Mat& mat);
|
void vector_Point3d_to_Mat(std::vector<cv::Point3d>& v_point, cv::Mat& mat);
|
||||||
|
|
||||||
|
void vector_Vec4f_to_Mat(std::vector<cv::Vec4f>& v_vec, cv::Mat& mat);
|
||||||
|
void vector_Vec6f_to_Mat(std::vector<cv::Vec6f>& v_vec, cv::Mat& mat);
|
||||||
|
|
||||||
void Mat_to_vector_KeyPoint(cv::Mat& mat, std::vector<cv::KeyPoint>& v_kp);
|
void Mat_to_vector_KeyPoint(cv::Mat& mat, std::vector<cv::KeyPoint>& v_kp);
|
||||||
void vector_KeyPoint_to_Mat(std::vector<cv::KeyPoint>& v_kp, cv::Mat& mat);
|
void vector_KeyPoint_to_Mat(std::vector<cv::KeyPoint>& v_kp, cv::Mat& mat);
|
||||||
|
|
||||||
@ -57,3 +60,5 @@ void Mat_to_vector_vector_char(cv::Mat& mat, std::vector< std::vector< char > >&
|
|||||||
void vector_vector_char_to_Mat(std::vector< std::vector< char > >& vv_ch, cv::Mat& mat);
|
void vector_vector_char_to_Mat(std::vector< std::vector< char > >& vv_ch, cv::Mat& mat);
|
||||||
|
|
||||||
void Mat_to_vector_vector_Point(cv::Mat& mat, std::vector< std::vector< cv::Point > >& vv_pt);
|
void Mat_to_vector_vector_Point(cv::Mat& mat, std::vector< std::vector< cv::Point > >& vv_pt);
|
||||||
|
void vector_vector_Point2f_to_Mat(std::vector< std::vector< cv::Point2f > >& vv_pt, cv::Mat& mat);
|
||||||
|
|
||||||
|
@ -25,41 +25,49 @@ public:
|
|||||||
MSER = 6,
|
MSER = 6,
|
||||||
GFTT = 7,
|
GFTT = 7,
|
||||||
HARRIS = 8,
|
HARRIS = 8,
|
||||||
|
SIMPLEBLOB = 9,
|
||||||
|
DENSE = 10,
|
||||||
|
|
||||||
|
|
||||||
GRIDRETECTOR = 1000,
|
GRIDRETECTOR = 1000,
|
||||||
|
|
||||||
GRID_FAST = GRIDRETECTOR + FAST,
|
GRID_FAST = GRIDRETECTOR + FAST,
|
||||||
GRID_STAR = GRIDRETECTOR + STAR,
|
GRID_STAR = GRIDRETECTOR + STAR,
|
||||||
GRID_SIFT = GRIDRETECTOR + SIFT,
|
GRID_SIFT = GRIDRETECTOR + SIFT,
|
||||||
GRID_SURF = GRIDRETECTOR + SURF,
|
GRID_SURF = GRIDRETECTOR + SURF,
|
||||||
GRID_ORB = GRIDRETECTOR + ORB,
|
GRID_ORB = GRIDRETECTOR + ORB,
|
||||||
GRID_MSER = GRIDRETECTOR + MSER,
|
GRID_MSER = GRIDRETECTOR + MSER,
|
||||||
GRID_GFTT = GRIDRETECTOR + GFTT,
|
GRID_GFTT = GRIDRETECTOR + GFTT,
|
||||||
GRID_HARRIS = GRIDRETECTOR + HARRIS,
|
GRID_HARRIS = GRIDRETECTOR + HARRIS,
|
||||||
|
GRID_SIMPLEBLOB = GRIDRETECTOR + SIMPLEBLOB,
|
||||||
|
GRID_DENSE = GRIDRETECTOR + DENSE,
|
||||||
|
|
||||||
|
|
||||||
PYRAMIDDETECTOR = 2000,
|
PYRAMIDDETECTOR = 2000,
|
||||||
|
|
||||||
PYRAMID_FAST = PYRAMIDDETECTOR + FAST,
|
PYRAMID_FAST = PYRAMIDDETECTOR + FAST,
|
||||||
PYRAMID_STAR = PYRAMIDDETECTOR + STAR,
|
PYRAMID_STAR = PYRAMIDDETECTOR + STAR,
|
||||||
PYRAMID_SIFT = PYRAMIDDETECTOR + SIFT,
|
PYRAMID_SIFT = PYRAMIDDETECTOR + SIFT,
|
||||||
PYRAMID_SURF = PYRAMIDDETECTOR + SURF,
|
PYRAMID_SURF = PYRAMIDDETECTOR + SURF,
|
||||||
PYRAMID_ORB = PYRAMIDDETECTOR + ORB,
|
PYRAMID_ORB = PYRAMIDDETECTOR + ORB,
|
||||||
PYRAMID_MSER = PYRAMIDDETECTOR + MSER,
|
PYRAMID_MSER = PYRAMIDDETECTOR + MSER,
|
||||||
PYRAMID_GFTT = PYRAMIDDETECTOR + GFTT,
|
PYRAMID_GFTT = PYRAMIDDETECTOR + GFTT,
|
||||||
PYRAMID_HARRIS = PYRAMIDDETECTOR + HARRIS,
|
PYRAMID_HARRIS = PYRAMIDDETECTOR + HARRIS,
|
||||||
|
PYRAMID_SIMPLEBLOB = PYRAMIDDETECTOR + SIMPLEBLOB,
|
||||||
|
PYRAMID_DENSE = PYRAMIDDETECTOR + DENSE,
|
||||||
|
|
||||||
DYNAMICDETECTOR = 3000,
|
DYNAMICDETECTOR = 3000,
|
||||||
|
|
||||||
DYNAMIC_FAST = DYNAMICDETECTOR + FAST,
|
DYNAMIC_FAST = DYNAMICDETECTOR + FAST,
|
||||||
DYNAMIC_STAR = DYNAMICDETECTOR + STAR,
|
DYNAMIC_STAR = DYNAMICDETECTOR + STAR,
|
||||||
DYNAMIC_SIFT = DYNAMICDETECTOR + SIFT,
|
DYNAMIC_SIFT = DYNAMICDETECTOR + SIFT,
|
||||||
DYNAMIC_SURF = DYNAMICDETECTOR + SURF,
|
DYNAMIC_SURF = DYNAMICDETECTOR + SURF,
|
||||||
DYNAMIC_ORB = DYNAMICDETECTOR + ORB,
|
DYNAMIC_ORB = DYNAMICDETECTOR + ORB,
|
||||||
DYNAMIC_MSER = DYNAMICDETECTOR + MSER,
|
DYNAMIC_MSER = DYNAMICDETECTOR + MSER,
|
||||||
DYNAMIC_GFTT = DYNAMICDETECTOR + GFTT,
|
DYNAMIC_GFTT = DYNAMICDETECTOR + GFTT,
|
||||||
DYNAMIC_HARRIS = DYNAMICDETECTOR + HARRIS
|
DYNAMIC_HARRIS = DYNAMICDETECTOR + HARRIS,
|
||||||
|
DYNAMIC_SIMPLEBLOB = DYNAMICDETECTOR + SIMPLEBLOB,
|
||||||
|
DYNAMIC_DENSE = DYNAMICDETECTOR + DENSE
|
||||||
};
|
};
|
||||||
|
|
||||||
//supported: FAST STAR SIFT SURF ORB MSER GFTT HARRIS Grid(XXXX) Pyramid(XXXX) Dynamic(XXXX)
|
//supported: FAST STAR SIFT SURF ORB MSER GFTT HARRIS Grid(XXXX) Pyramid(XXXX) Dynamic(XXXX)
|
||||||
@ -109,6 +117,12 @@ public:
|
|||||||
case HARRIS:
|
case HARRIS:
|
||||||
name += "HARRIS";
|
name += "HARRIS";
|
||||||
break;
|
break;
|
||||||
|
case SIMPLEBLOB:
|
||||||
|
name += "SimpleBlob";
|
||||||
|
break;
|
||||||
|
case DENSE:
|
||||||
|
name += "Dense";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
CV_Error( CV_StsBadArg, "Specified feature detector type is not supported." );
|
CV_Error( CV_StsBadArg, "Specified feature detector type is not supported." );
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user