|
|
|
|
@@ -13,6 +13,7 @@ import org.opencv.core.Size;
|
|
|
|
|
import org.opencv.core.Core;
|
|
|
|
|
import org.opencv.imgproc.Imgproc;
|
|
|
|
|
import org.opencv.test.OpenCVTestCase;
|
|
|
|
|
import org.opencv.test.OpenCVTestRunner;
|
|
|
|
|
|
|
|
|
|
public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
|
|
|
|
|
@@ -31,7 +32,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
|
|
|
|
|
gray_64f_2 = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(2));
|
|
|
|
|
dst64F = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(0));
|
|
|
|
|
mask = new Mat (imgprocSz, imgprocSz, CvType.CV_8U, new Scalar(1));
|
|
|
|
|
mask = new Mat(imgprocSz, imgprocSz, CvType.CV_8U, new Scalar(1));
|
|
|
|
|
anchorPoint = new Point(2, 2);
|
|
|
|
|
size = new Size(3, 3);
|
|
|
|
|
}
|
|
|
|
|
@@ -53,7 +54,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
public void testAccumulateMatMatMat() {
|
|
|
|
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(2));
|
|
|
|
|
|
|
|
|
|
Imgproc.accumulate(gray_64f_2, dst64F, mask); //TODO: use better mask
|
|
|
|
|
Imgproc.accumulate(gray_64f_2, dst64F, mask); // TODO: use better mask
|
|
|
|
|
assertMatEqual(truth, dst64F);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -68,7 +69,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
truth.put(0, 0, 2, 1);
|
|
|
|
|
truth.put(1, 0, 1, 2);
|
|
|
|
|
|
|
|
|
|
Mat dstImage = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(0));
|
|
|
|
|
Mat dstImage = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(
|
|
|
|
|
0));
|
|
|
|
|
Imgproc.accumulateProduct(src1, src2, dstImage);
|
|
|
|
|
assertMatEqual(truth, dstImage);
|
|
|
|
|
}
|
|
|
|
|
@@ -118,7 +120,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testAdaptiveThreshold() {
|
|
|
|
|
Imgproc.adaptiveThreshold(gray0, dst, 2.0, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C, Imgproc.THRESH_BINARY, 3, 0);
|
|
|
|
|
Imgproc.adaptiveThreshold(gray0, dst, 2.0,
|
|
|
|
|
Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C, Imgproc.THRESH_BINARY, 3, 0);
|
|
|
|
|
assertMatEqual(gray0, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -148,7 +151,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testBilateralFilterMatMatIntDoubleDoubleInt() {
|
|
|
|
|
Imgproc.bilateralFilter(gray255, dst, 5, 10.0, 5.0, Imgproc.BORDER_REFLECT);
|
|
|
|
|
Imgproc.bilateralFilter(gray255, dst, 5, 10.0, 5.0,
|
|
|
|
|
Imgproc.BORDER_REFLECT);
|
|
|
|
|
assertMatEqual(gray255, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -171,7 +175,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testBorderInterpolate() {
|
|
|
|
|
float val1 = Imgproc.borderInterpolate(100, 150, Imgproc.BORDER_REFLECT_101);
|
|
|
|
|
float val1 = Imgproc.borderInterpolate(100, 150,
|
|
|
|
|
Imgproc.BORDER_REFLECT_101);
|
|
|
|
|
assertEquals(100.0f, val1);
|
|
|
|
|
|
|
|
|
|
float val2 = Imgproc.borderInterpolate(-5, 10, Imgproc.BORDER_WRAP);
|
|
|
|
|
@@ -207,7 +212,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testBoxFilterMatMatIntSizePointBooleanInt() {
|
|
|
|
|
Imgproc.boxFilter(gray255, dst, 8, size, anchorPoint, false, Imgproc.BORDER_REFLECT);
|
|
|
|
|
Imgproc.boxFilter(gray255, dst, 8, size, anchorPoint, false,
|
|
|
|
|
Imgproc.BORDER_REFLECT);
|
|
|
|
|
assertMatEqual(gray255, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -242,7 +248,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
images.add(gray128);
|
|
|
|
|
channels.add(0);
|
|
|
|
|
histSize.add(10);
|
|
|
|
|
ranges.add(0.0f); ranges.add(256.0f);
|
|
|
|
|
ranges.add(0.0f);
|
|
|
|
|
ranges.add(256.0f);
|
|
|
|
|
|
|
|
|
|
truth = new Mat(10, 1, CvType.CV_32F, Scalar.all(0.0));
|
|
|
|
|
truth.put(5, 0, 100.0);
|
|
|
|
|
@@ -267,8 +274,10 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
histSize.add(10);
|
|
|
|
|
histSize.add(10);
|
|
|
|
|
|
|
|
|
|
ranges.add(0.0f); ranges.add(256.0f);
|
|
|
|
|
ranges.add(0.0f); ranges.add(256.0f);
|
|
|
|
|
ranges.add(0.0f);
|
|
|
|
|
ranges.add(256.0f);
|
|
|
|
|
ranges.add(0.0f);
|
|
|
|
|
ranges.add(256.0f);
|
|
|
|
|
|
|
|
|
|
truth = new Mat(10, 10, CvType.CV_32F, Scalar.all(0.0));
|
|
|
|
|
truth.put(9, 5, 100.0);
|
|
|
|
|
@@ -294,12 +303,15 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
histSize.add(10);
|
|
|
|
|
histSize.add(10);
|
|
|
|
|
|
|
|
|
|
ranges.add(0.0f); ranges.add(256.0f);
|
|
|
|
|
ranges.add(0.0f); ranges.add(256.0f);
|
|
|
|
|
ranges.add(0.0f);
|
|
|
|
|
ranges.add(256.0f);
|
|
|
|
|
ranges.add(0.0f);
|
|
|
|
|
ranges.add(256.0f);
|
|
|
|
|
|
|
|
|
|
truth = new Mat(10, 10, CvType.CV_32F, Scalar.all(0.0));
|
|
|
|
|
truth.put(9, 5, 100.0);
|
|
|
|
|
Imgproc.calcHist(images, channels, new Mat(), hist, histSize, ranges, true);
|
|
|
|
|
Imgproc.calcHist(images, channels, new Mat(), hist, histSize, ranges,
|
|
|
|
|
true);
|
|
|
|
|
assertMatEqual(truth, hist);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -351,7 +363,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
Mat dstmap1 = new Mat(1, 4, CvType.CV_16SC2);
|
|
|
|
|
Mat dstmap2 = new Mat(1, 4, CvType.CV_16UC1);
|
|
|
|
|
|
|
|
|
|
//FIXME: dstmap1 - Documentation says Cvtype but requires integer
|
|
|
|
|
// FIXME: dstmap1 - Documentation says Cvtype but requires integer
|
|
|
|
|
Imgproc.convertMaps(map1, map2, dstmap1, dstmap2, CvType.CV_32F);
|
|
|
|
|
fail("Not yet implemented");
|
|
|
|
|
}
|
|
|
|
|
@@ -362,7 +374,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
|
|
|
|
|
public void testConvexHullMatMat() {
|
|
|
|
|
Mat points = new Mat(1, 6, CvType.CV_32FC2);
|
|
|
|
|
points.put(0, 0, 2.0, 0.0, 4.0, 0.0, 3.0, 2.0, 0.0, 2.0, 2.0, 1.0, 3.0, 1.0);
|
|
|
|
|
points.put(0, 0, 2.0, 0.0, 4.0, 0.0, 3.0, 2.0, 0.0, 2.0, 2.0, 1.0, 3.0,
|
|
|
|
|
1.0);
|
|
|
|
|
|
|
|
|
|
Mat expHull = new Mat(4, 1, CvType.CV_32FC2);
|
|
|
|
|
expHull.put(0, 0, 4, 0, 3, 2, 0, 2, 2, 0);
|
|
|
|
|
@@ -371,10 +384,10 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
assertMatEqual(expHull, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testConvexHullMatMatBoolean() {
|
|
|
|
|
Mat points = new Mat(1, 6, CvType.CV_32FC2);
|
|
|
|
|
points.put(0, 0, 2.0, 0.0, 4.0, 0.0, 3.0, 2.0, 0.0, 2.0, 2.0, 1.0, 3.0, 1.0);
|
|
|
|
|
points.put(0, 0, 2.0, 0.0, 4.0, 0.0, 3.0, 2.0, 0.0, 2.0, 2.0, 1.0, 3.0,
|
|
|
|
|
1.0);
|
|
|
|
|
|
|
|
|
|
Mat expHull = new Mat(4, 1, CvType.CV_32FC2);
|
|
|
|
|
expHull.put(0, 0, 0, 2, 3, 2, 4, 0, 2, 0);
|
|
|
|
|
@@ -385,7 +398,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
|
|
|
|
|
public void testConvexHullMatMatBooleanBoolean() {
|
|
|
|
|
Mat points = new Mat(1, 6, CvType.CV_32FC2);
|
|
|
|
|
points.put(0, 0, 2.0, 0.0, 4.0, 0.0, 3.0, 2.0, 0.0, 2.0, 2.0, 1.0, 3.0, 1.0);
|
|
|
|
|
points.put(0, 0, 2.0, 0.0, 4.0, 0.0, 3.0, 2.0, 0.0, 2.0, 2.0, 1.0, 3.0,
|
|
|
|
|
1.0);
|
|
|
|
|
|
|
|
|
|
Mat expHull = new Mat(4, 1, CvType.CV_32FC2);
|
|
|
|
|
expHull.put(0, 0, 0, 2, 3, 2, 4, 0, 2, 0);
|
|
|
|
|
@@ -399,7 +413,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
truth = new Mat(6, 6, CvType.CV_32F, new Scalar(1));
|
|
|
|
|
int border = 2;
|
|
|
|
|
|
|
|
|
|
Imgproc.copyMakeBorder(src, dst, border, border, border, border, Imgproc.BORDER_REPLICATE);
|
|
|
|
|
Imgproc.copyMakeBorder(src, dst, border, border, border, border,
|
|
|
|
|
Imgproc.BORDER_REPLICATE);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -410,7 +425,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
Scalar value = new Scalar(0);
|
|
|
|
|
int border = 2;
|
|
|
|
|
|
|
|
|
|
Imgproc.copyMakeBorder(src, dst, border, border, border, border, Imgproc.BORDER_REPLICATE, value);
|
|
|
|
|
Imgproc.copyMakeBorder(src, dst, border, border, border, border,
|
|
|
|
|
Imgproc.BORDER_REPLICATE, value);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -422,7 +438,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
int blockSize = 3;
|
|
|
|
|
int ksize = 5;
|
|
|
|
|
|
|
|
|
|
//TODO: eigen vals and vectors returned = 0 for most src matrices
|
|
|
|
|
// TODO: eigen vals and vectors returned = 0 for most src matrices
|
|
|
|
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32FC(6), new Scalar(0));
|
|
|
|
|
Imgproc.cornerEigenValsAndVecs(src, dst, blockSize, ksize);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
@@ -436,7 +452,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
|
|
|
|
|
truth = new Mat(4, 4, CvType.CV_32FC(6), new Scalar(0));
|
|
|
|
|
|
|
|
|
|
Imgproc.cornerEigenValsAndVecs(src, dst, blockSize, ksize, Imgproc.BORDER_REFLECT);
|
|
|
|
|
Imgproc.cornerEigenValsAndVecs(src, dst, blockSize, ksize,
|
|
|
|
|
Imgproc.BORDER_REFLECT);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -454,7 +471,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
int blockSize = 5;
|
|
|
|
|
int ksize = 7;
|
|
|
|
|
double k = 0.1;
|
|
|
|
|
Imgproc.cornerHarris(gray255, dst, blockSize, ksize, k, Imgproc.BORDER_REFLECT);
|
|
|
|
|
Imgproc.cornerHarris(gray255, dst, blockSize, ksize, k,
|
|
|
|
|
Imgproc.BORDER_REFLECT);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -500,7 +518,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
truth.put(1, 0, 0.92708343, 0.92708343, 0.92708343);
|
|
|
|
|
truth.put(2, 0, 0.58680564, 0.92708343, 0.68055564);
|
|
|
|
|
|
|
|
|
|
Imgproc.cornerMinEigenVal(src, dst, blockSize, ksize, Imgproc.BORDER_REFLECT);
|
|
|
|
|
Imgproc.cornerMinEigenVal(src, dst, blockSize, ksize,
|
|
|
|
|
Imgproc.BORDER_REFLECT);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -544,7 +563,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
public void testDilateMatMatMatPointIntInt() {
|
|
|
|
|
Mat kernel = new Mat();
|
|
|
|
|
|
|
|
|
|
Imgproc.dilate(gray255, dst, kernel, anchorPoint, 10, Imgproc.BORDER_REFLECT);
|
|
|
|
|
Imgproc.dilate(gray255, dst, kernel, anchorPoint, 10,
|
|
|
|
|
Imgproc.BORDER_REFLECT);
|
|
|
|
|
assertMatEqual(gray255, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -552,13 +572,15 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
Mat kernel = new Mat();
|
|
|
|
|
Scalar value = new Scalar(0);
|
|
|
|
|
|
|
|
|
|
Imgproc.dilate(gray255, dst, kernel, anchorPoint, 10, Imgproc.BORDER_REFLECT, value);
|
|
|
|
|
Imgproc.dilate(gray255, dst, kernel, anchorPoint, 10,
|
|
|
|
|
Imgproc.BORDER_REFLECT, value);
|
|
|
|
|
assertMatEqual(gray255, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testDistanceTransform() {
|
|
|
|
|
truth = new Mat(matSize, matSize, CvType.CV_32FC1, new Scalar(8192));
|
|
|
|
|
Mat dstLables = new Mat(matSize, matSize, CvType.CV_32SC1, new Scalar(0));
|
|
|
|
|
Mat dstLables = new Mat(matSize, matSize, CvType.CV_32SC1,
|
|
|
|
|
new Scalar(0));
|
|
|
|
|
|
|
|
|
|
Mat labels = new Mat();
|
|
|
|
|
Imgproc.distanceTransform(gray128, dst, labels, Imgproc.CV_DIST_L2, 3);
|
|
|
|
|
@@ -653,13 +675,15 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
Mat kernel = new Mat();
|
|
|
|
|
Scalar sc = new Scalar(3, 3);
|
|
|
|
|
|
|
|
|
|
Imgproc.erode(src, dst, kernel, anchorPoint, 10, Imgproc.BORDER_REFLECT, sc);
|
|
|
|
|
Imgproc.erode(src, dst, kernel, anchorPoint, 10,
|
|
|
|
|
Imgproc.BORDER_REFLECT, sc);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testFilter2DMatMatIntMat() {
|
|
|
|
|
Mat src = Mat.eye(4, 4, CvType.CV_32F);
|
|
|
|
|
Mat kernel = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(1.0));
|
|
|
|
|
Mat kernel = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(
|
|
|
|
|
1.0));
|
|
|
|
|
|
|
|
|
|
truth = Mat.eye(4, 4, CvType.CV_32F);
|
|
|
|
|
truth.put(0, 0, 2, 2, 1, 0);
|
|
|
|
|
@@ -672,7 +696,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testFilter2DMatMatIntMatPoint() {
|
|
|
|
|
Mat kernel = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(1.0));
|
|
|
|
|
Mat kernel = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(
|
|
|
|
|
1.0));
|
|
|
|
|
Point point = new Point(0, 0);
|
|
|
|
|
|
|
|
|
|
Imgproc.filter2D(gray128, dst, -1, kernel, point);
|
|
|
|
|
@@ -680,10 +705,12 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testFilter2DMatMatIntMatPointDoubleInt() {
|
|
|
|
|
Mat kernel = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(0.0));
|
|
|
|
|
Mat kernel = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(
|
|
|
|
|
0.0));
|
|
|
|
|
Point point = new Point(0, 0);
|
|
|
|
|
|
|
|
|
|
Imgproc.filter2D(gray128, dst, -1, kernel, point, 2.0, Imgproc.BORDER_CONSTANT);
|
|
|
|
|
Imgproc.filter2D(gray128, dst, -1, kernel, point, 2.0,
|
|
|
|
|
Imgproc.BORDER_CONSTANT);
|
|
|
|
|
assertMatEqual(gray2, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -696,7 +723,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testFitEllipse() {
|
|
|
|
|
Mat points = new Mat(1, 5, CvType.CV_32FC2); //TODO: use the list of Points
|
|
|
|
|
Mat points = new Mat(1, 5, CvType.CV_32FC2); // TODO: use the list of
|
|
|
|
|
// Points
|
|
|
|
|
points.put(0, 0, 0.0, 0.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0);
|
|
|
|
|
|
|
|
|
|
RotatedRect rrect = new RotatedRect();
|
|
|
|
|
@@ -719,7 +747,23 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testFloodFillMatMatPointScalar() {
|
|
|
|
|
fail("Not yet implemented");
|
|
|
|
|
Mat mask = new Mat(matSize + 2, matSize + 2, CvType.CV_8U);
|
|
|
|
|
Mat img = gray0;
|
|
|
|
|
|
|
|
|
|
img.setTo(new Scalar(0));
|
|
|
|
|
mask.setTo(new Scalar(0));
|
|
|
|
|
|
|
|
|
|
Core.circle(mask, new Point(matSize / 2 + 1, matSize / 2 + 1), 3, new Scalar(2));
|
|
|
|
|
|
|
|
|
|
int retval = Imgproc.floodFill(img, mask, new Point(matSize / 2, matSize / 2), new Scalar(1));
|
|
|
|
|
|
|
|
|
|
assertEquals(Core.countNonZero(img), retval);
|
|
|
|
|
|
|
|
|
|
Core.circle(mask, new Point(matSize / 2 + 1, matSize / 2 + 1), 3, new Scalar(0));
|
|
|
|
|
|
|
|
|
|
assertEquals(retval + 4 * (matSize + 1), Core.countNonZero(mask));
|
|
|
|
|
|
|
|
|
|
assertMatEqual(mask.submat(1, matSize+1, 1, matSize+1), img);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testFloodFillMatMatPointScalarRect() {
|
|
|
|
|
@@ -902,7 +946,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
truth.put(1, 0, 0, 0, 1);
|
|
|
|
|
truth.put(2, 0, 1, 1, 1);
|
|
|
|
|
|
|
|
|
|
dst = Imgproc.getStructuringElement(Imgproc.MORPH_CROSS, size, anchorPoint);
|
|
|
|
|
dst = Imgproc.getStructuringElement(Imgproc.MORPH_CROSS, size,
|
|
|
|
|
anchorPoint);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1006,8 +1051,9 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
Mat map1 = new Mat();
|
|
|
|
|
Mat map2 = new Mat();
|
|
|
|
|
|
|
|
|
|
//FIXME: dstmap1 - Documentation says Cvtype but requires integer
|
|
|
|
|
Imgproc.initUndistortRectifyMap(cameraMatrix, distCoeffs, R, newCameraMatrix, size, CvType.CV_32F, map1, map2);
|
|
|
|
|
// FIXME: dstmap1 - Documentation says Cvtype but requires integer
|
|
|
|
|
Imgproc.initUndistortRectifyMap(cameraMatrix, distCoeffs, R,
|
|
|
|
|
newCameraMatrix, size, CvType.CV_32F, map1, map2);
|
|
|
|
|
fail("Not yet implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1026,7 +1072,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
|
|
|
|
|
distCoeffs.put(0, 0, 1.0, 3.0, 2.0, 4);
|
|
|
|
|
// TODO: No documentation for this function
|
|
|
|
|
// Imgproc.initWideAngleProjMap(cameraMatrix, distCoeffs, imageSize, 5.0, m1type, truthput1, truthput2);
|
|
|
|
|
// Imgproc.initWideAngleProjMap(cameraMatrix, distCoeffs, imageSize,
|
|
|
|
|
// 5.0, m1type, truthput1, truthput2);
|
|
|
|
|
fail("Not yet implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1220,7 +1267,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
Mat src = new Mat(3, 3, CvType.CV_32F, new Scalar(2.0));
|
|
|
|
|
truth = new Mat(3, 3, CvType.CV_32F, new Scalar(0.00099945068));
|
|
|
|
|
|
|
|
|
|
Imgproc.Laplacian(src, dst, CvType.CV_32F, 1, 2.0, EPS, Imgproc.BORDER_REFLECT);
|
|
|
|
|
Imgproc.Laplacian(src, dst, CvType.CV_32F, 1, 2.0, EPS,
|
|
|
|
|
Imgproc.BORDER_REFLECT);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1231,8 +1279,9 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
contour1.put(0, 0, 1.0, 1.0, 5.0, 1.0, 4.0, 3.0, 6.0, 2.0);
|
|
|
|
|
contour1.put(0, 0, 1.0, 1.0, 6.0, 1.0, 4.0, 1.0, 2.0, 5.0);
|
|
|
|
|
|
|
|
|
|
//TODO: returns random comparers
|
|
|
|
|
double comparer = Imgproc.matchShapes(contour1, contour2, Imgproc.CV_CONTOURS_MATCH_I1, 1.0);
|
|
|
|
|
// TODO: returns random comparers
|
|
|
|
|
double comparer = Imgproc.matchShapes(contour1, contour2,
|
|
|
|
|
Imgproc.CV_CONTOURS_MATCH_I1, 1.0);
|
|
|
|
|
double expComparer = 2.98;
|
|
|
|
|
assertEquals(expComparer, comparer);
|
|
|
|
|
}
|
|
|
|
|
@@ -1277,7 +1326,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
float radius = 0.0f;
|
|
|
|
|
// float expectedRadius = 1.0f;
|
|
|
|
|
points.put(0, 0, -1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, -1.0);
|
|
|
|
|
//TODO: Unexpected radius is returned i.e 0
|
|
|
|
|
// TODO: Unexpected radius is returned i.e 0
|
|
|
|
|
Imgproc.minEnclosingCircle(points, actualCenter, radius);
|
|
|
|
|
assertEquals(expCenter, actualCenter);
|
|
|
|
|
// assertEquals(expectedRadius, radius);
|
|
|
|
|
@@ -1328,7 +1377,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
Mat kernel = new Mat(imgprocSz, imgprocSz, CvType.CV_8U, new Scalar(1));
|
|
|
|
|
Point point = new Point(1, 1);
|
|
|
|
|
|
|
|
|
|
Imgproc.morphologyEx(src, dst, Imgproc.MORPH_TOPHAT, kernel, point, 10, Imgproc.BORDER_REFLECT);
|
|
|
|
|
Imgproc.morphologyEx(src, dst, Imgproc.MORPH_TOPHAT, kernel, point, 10,
|
|
|
|
|
Imgproc.BORDER_REFLECT);
|
|
|
|
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_8U);
|
|
|
|
|
truth.put(0, 0, 1, 0);
|
|
|
|
|
truth.put(1, 0, 1, 0);
|
|
|
|
|
@@ -1344,7 +1394,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
Point point = new Point(1, 1);
|
|
|
|
|
Scalar sc = new Scalar(3, 3);
|
|
|
|
|
|
|
|
|
|
Imgproc.morphologyEx(src, dst, Imgproc.MORPH_TOPHAT, kernel, point, 10, Imgproc.BORDER_REFLECT, sc);
|
|
|
|
|
Imgproc.morphologyEx(src, dst, Imgproc.MORPH_TOPHAT, kernel, point, 10,
|
|
|
|
|
Imgproc.BORDER_REFLECT, sc);
|
|
|
|
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_8U);
|
|
|
|
|
truth.put(0, 0, 1, 0);
|
|
|
|
|
truth.put(1, 0, 1, 0);
|
|
|
|
|
@@ -1399,6 +1450,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
truth.put(1, 0, 8.546875, 8.8515625);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testPyrDownMatMatSize() {
|
|
|
|
|
Mat src = new Mat(4, 4, CvType.CV_32F);
|
|
|
|
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F);
|
|
|
|
|
@@ -1419,7 +1471,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
public void testPyrMeanShiftFilteringMatMatDoubleDouble() {
|
|
|
|
|
Mat src = new Mat(matSize, matSize, CvType.CV_8UC3, new Scalar(0.0));
|
|
|
|
|
Imgproc.pyrMeanShiftFiltering(src, dst, 2.0, 4.0);
|
|
|
|
|
//TODO : size of destination matrix not understandable
|
|
|
|
|
// TODO : size of destination matrix not understandable
|
|
|
|
|
fail("Not yet implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1486,7 +1538,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
|
|
|
|
|
truth = new Mat(1, 3, CvType.CV_32F, new Scalar(2));
|
|
|
|
|
|
|
|
|
|
Imgproc.remap(src, dst, map1, map2, Imgproc.INTER_LINEAR, Imgproc.BORDER_REFLECT);
|
|
|
|
|
Imgproc.remap(src, dst, map1, map2, Imgproc.INTER_LINEAR,
|
|
|
|
|
Imgproc.BORDER_REFLECT);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1502,7 +1555,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
|
|
|
|
|
truth = new Mat(1, 3, CvType.CV_32F, new Scalar(2));
|
|
|
|
|
|
|
|
|
|
Imgproc.remap(src, dst, map1, map2, Imgproc.INTER_LINEAR, Imgproc.BORDER_REFLECT, sc);
|
|
|
|
|
Imgproc.remap(src, dst, map1, map2, Imgproc.INTER_LINEAR,
|
|
|
|
|
Imgproc.BORDER_REFLECT, sc);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1571,7 +1625,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
truth.put(1, 0, 10.5, 0, -10.5);
|
|
|
|
|
truth.put(2, 0, 4.5, 19.5, 15);
|
|
|
|
|
|
|
|
|
|
Imgproc.Scharr(src, dst, CvType.CV_32F, 1, 0, 1.5, 0.0, Imgproc.BORDER_REFLECT);
|
|
|
|
|
Imgproc.Scharr(src, dst, CvType.CV_32F, 1, 0, 1.5, 0.0,
|
|
|
|
|
Imgproc.BORDER_REFLECT);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1589,7 +1644,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testSepFilter2DMatMatIntMatMatPoint() {
|
|
|
|
|
Mat src = new Mat(imgprocSz, imgprocSz, CvType.CV_32FC1, new Scalar(2.0));
|
|
|
|
|
Mat src = new Mat(imgprocSz, imgprocSz, CvType.CV_32FC1,
|
|
|
|
|
new Scalar(2.0));
|
|
|
|
|
Mat kernelX = new Mat(1, 3, CvType.CV_32FC1);
|
|
|
|
|
Mat kernelY = new Mat(1, 3, CvType.CV_32FC1);
|
|
|
|
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(36.0));
|
|
|
|
|
@@ -1597,12 +1653,14 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
kernelX.put(0, 0, 2.0, 2.0, 2.0);
|
|
|
|
|
kernelY.put(0, 0, 1.0, 1.0, 1.0);
|
|
|
|
|
|
|
|
|
|
Imgproc.sepFilter2D(src, dst, CvType.CV_32F, kernelX, kernelY, anchorPoint);
|
|
|
|
|
Imgproc.sepFilter2D(src, dst, CvType.CV_32F, kernelX, kernelY,
|
|
|
|
|
anchorPoint);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testSepFilter2DMatMatIntMatMatPointDouble() {
|
|
|
|
|
Mat src = new Mat(imgprocSz, imgprocSz, CvType.CV_32FC1, new Scalar(2.0));
|
|
|
|
|
Mat src = new Mat(imgprocSz, imgprocSz, CvType.CV_32FC1,
|
|
|
|
|
new Scalar(2.0));
|
|
|
|
|
|
|
|
|
|
Mat kernelX = new Mat(1, 3, CvType.CV_32FC1);
|
|
|
|
|
kernelX.put(0, 0, 2.0, 2.0, 2.0);
|
|
|
|
|
@@ -1611,7 +1669,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
kernelY.put(0, 0, 1.0, 1.0, 1.0);
|
|
|
|
|
|
|
|
|
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(36.001));
|
|
|
|
|
Imgproc.sepFilter2D(src, dst, CvType.CV_32F, kernelX, kernelY, anchorPoint, EPS);
|
|
|
|
|
Imgproc.sepFilter2D(src, dst, CvType.CV_32F, kernelX, kernelY,
|
|
|
|
|
anchorPoint, EPS);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1623,7 +1682,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
kernelY.put(0, 0, 1.0, 1.0, 1.0);
|
|
|
|
|
|
|
|
|
|
truth = new Mat(10, 10, CvType.CV_32F, new Scalar(0.001));
|
|
|
|
|
Imgproc.sepFilter2D(gray0, dst, CvType.CV_32F, kernelX, kernelY, anchorPoint, EPS, Imgproc.BORDER_REFLECT);
|
|
|
|
|
Imgproc.sepFilter2D(gray0, dst, CvType.CV_32F, kernelX, kernelY,
|
|
|
|
|
anchorPoint, EPS, Imgproc.BORDER_REFLECT);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1669,7 +1729,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
truth.put(1, 0, -14, -12, 2);
|
|
|
|
|
truth.put(2, 0, -10, 0, 10);
|
|
|
|
|
|
|
|
|
|
Imgproc.Sobel(src, dst, CvType.CV_32F, 1, 0, 3, 2.0, 0.0, Imgproc.BORDER_REPLICATE);
|
|
|
|
|
Imgproc.Sobel(src, dst, CvType.CV_32F, 1, 0, 3, 2.0, 0.0,
|
|
|
|
|
Imgproc.BORDER_REPLICATE);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1725,7 +1786,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testWarpAffineMatMatMatSize() {
|
|
|
|
|
Mat src = new Mat(3, 3, CvType.CV_32F);;
|
|
|
|
|
Mat src = new Mat(3, 3, CvType.CV_32F);
|
|
|
|
|
;
|
|
|
|
|
Mat M = new Mat(2, 3, CvType.CV_32F);
|
|
|
|
|
|
|
|
|
|
src.put(0, 0, 2, 0, 1);
|
|
|
|
|
@@ -1740,7 +1802,6 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
M.put(0, 0, 1, 0, 1);
|
|
|
|
|
M.put(1, 0, 0, 1, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Imgproc.warpAffine(src, dst, M, size);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
@@ -1779,7 +1840,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
truth.put(0, 0, 2, 4);
|
|
|
|
|
truth.put(1, 0, 6, 4);
|
|
|
|
|
|
|
|
|
|
Imgproc.warpAffine(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP, Imgproc.BORDER_TRANSPARENT);
|
|
|
|
|
Imgproc.warpAffine(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP,
|
|
|
|
|
Imgproc.BORDER_TRANSPARENT);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1800,7 +1862,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
truth.put(0, 0, 6, 4);
|
|
|
|
|
truth.put(1, 0, 6, 4);
|
|
|
|
|
|
|
|
|
|
Imgproc.warpAffine(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP, Imgproc.BORDER_CONSTANT, sc);
|
|
|
|
|
Imgproc.warpAffine(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP,
|
|
|
|
|
Imgproc.BORDER_CONSTANT, sc);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1862,7 +1925,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
truth.put(0, 0, 6, 4);
|
|
|
|
|
truth.put(1, 0, 6, 4);
|
|
|
|
|
|
|
|
|
|
Imgproc.warpPerspective(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP, Imgproc.BORDER_REFLECT);
|
|
|
|
|
Imgproc.warpPerspective(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP,
|
|
|
|
|
Imgproc.BORDER_REFLECT);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1880,7 +1944,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
truth.put(0, 0, 2, 4);
|
|
|
|
|
truth.put(1, 0, 6, 4);
|
|
|
|
|
|
|
|
|
|
Imgproc.warpPerspective(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP, Imgproc.BORDER_REFLECT, sc);
|
|
|
|
|
Imgproc.warpPerspective(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP,
|
|
|
|
|
Imgproc.BORDER_REFLECT, sc);
|
|
|
|
|
assertMatEqual(truth, dst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1890,7 +1955,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|
|
|
|
|
|
|
|
|
truth = new Mat(4, 4, CvType.CV_32SC1);
|
|
|
|
|
truth.put(0, 0, -1, -1, -1, -1);
|
|
|
|
|
truth.put(1, 0,-1, 0, 0, -1);
|
|
|
|
|
truth.put(1, 0, -1, 0, 0, -1);
|
|
|
|
|
truth.put(2, 0, -1, 0, 0, -1);
|
|
|
|
|
truth.put(3, 0, -1, -1, -1, -1);
|
|
|
|
|
|
|
|
|
|
|