import org.opencv.core.Core.MinMaxLocResult;
import org.opencv.core.CvException;
import org.opencv.core.CvType;
+import org.opencv.core.CvVectorDouble;
+import org.opencv.core.CvVectorInt;
+import org.opencv.core.CvVectorPoint;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Rect;
int arcStart = 30;
int arcEnd = 60;
int delta = 2;
- List<Point> pts = new ArrayList<Point>();
+ CvVectorPoint pts = new CvVectorPoint();
Core.ellipse2Poly(center, axes, angle, arcStart, arcEnd, delta, pts);
- List<Point> truth = Arrays.asList(
+ Point truth[] = {
new Point(5, 6),
new Point(5, 6),
new Point(5, 6),
new Point(4, 6),
new Point(4, 6),
new Point(4, 6),
- new Point(4, 6));
- assertListPointEquals(truth, pts, EPS);
+ new Point(4, 6)
+ };
+ assertArrayPointsEquals(truth, pts.toArray(new Point[0]), EPS);
}
public void testEllipseMatPointSizeDoubleDoubleDoubleScalar() {
}
public void testFillConvexPolyMatListOfPointScalar() {
- List<Point> polyline = Arrays.asList(new Point(1, 1), new Point(5, 0), new Point(6, 8), new Point(0, 9));
+ CvVectorPoint polyline = new CvVectorPoint(new Point[]{new Point(1, 1), new Point(5, 0), new Point(6, 8), new Point(0, 9)});
Core.fillConvexPoly(gray0, polyline, new Scalar(150));
}
public void testFillConvexPolyMatListOfPointScalarIntInt() {
- List<Point> polyline1 = Arrays.asList(new Point(2, 1), new Point(5, 1), new Point(5, 7), new Point(2, 7));
- List<Point> polyline2 = Arrays.asList(new Point(4, 2), new Point(10, 2), new Point(10, 14), new Point(4, 14));
+ CvVectorPoint polyline1 = new CvVectorPoint(new Point(2, 1), new Point(5, 1), new Point(5, 7), new Point(2, 7));
+ CvVectorPoint polyline2 = new CvVectorPoint(new Point(4, 2), new Point(10, 2), new Point(10, 14), new Point(4, 14));
// current implementation of fixed-point version of fillConvexPoly
// requires image to be at least 2-pixel wider in each direction than
public void testFillPolyMatListOfListOfPointScalar() {
int matSize = 10;
Mat gray0 = Mat.zeros(matSize, matSize, CvType.CV_8U);
- List<Point> polyline = Arrays.asList(new Point(1, 4), new Point(1, 8), new Point(4, 1), new Point(7, 8), new Point(7, 4));
- List<List<Point>> polylines = new ArrayList<List<Point>>();
+ CvVectorPoint polyline = new CvVectorPoint(new Point(1, 4), new Point(1, 8), new Point(4, 1), new Point(7, 8), new Point(7, 4));
+ List<CvVectorPoint> polylines = new ArrayList<CvVectorPoint>();
polylines.add(polyline);
Core.fillPoly(gray0, polylines, new Scalar(1));
}
public void testFillPolyMatListOfListOfPointScalarIntIntPoint() {
- List<Point> polyline1 = Arrays.asList(new Point(1, 4), new Point(1, 8), new Point(4, 1), new Point(7, 8), new Point(7, 4));
- List<Point> polyline2 = Arrays.asList(new Point(0, 3), new Point(0, 7), new Point(3, 0), new Point(6, 7), new Point(6, 3));
+ CvVectorPoint polyline1 = new CvVectorPoint(new Point(1, 4), new Point(1, 8), new Point(4, 1), new Point(7, 8), new Point(7, 4));
+ CvVectorPoint polyline2 = new CvVectorPoint(new Point(0, 3), new Point(0, 7), new Point(3, 0), new Point(6, 7), new Point(6, 3));
- List<List<Point>> polylines1 = new ArrayList<List<Point>>();
+ List<CvVectorPoint> polylines1 = new ArrayList<CvVectorPoint>();
polylines1.add(polyline1);
- List<List<Point>> polylines2 = new ArrayList<List<Point>>();
+ List<CvVectorPoint> polylines2 = new ArrayList<CvVectorPoint>();
polylines2.add(polyline2);
Core.fillPoly(gray0, polylines1, new Scalar(1), Core.LINE_8, 0, new Point(0, 0));
}
public void testMeanStdDevMatMatMat() {
- List<Double> mean = new ArrayList<Double>();
- List<Double> stddev = new ArrayList<Double>();
+ CvVectorDouble mean = new CvVectorDouble();
+ CvVectorDouble stddev = new CvVectorDouble();
Core.meanStdDev(rgbLena, mean, stddev);
- List<Double> expectedMean = Arrays.asList( new Double[]
- {105.3989906311035, 99.56269836425781, 179.7303047180176} );
- List<Double> expectedDev = Arrays.asList( new Double[]
- {33.74205485167219, 52.8734582803278, 49.01569488056406} );
+ double expectedMean[] = new double[]
+ {105.3989906311035, 99.56269836425781, 179.7303047180176};
+ double expectedDev[] = new double[]
+ {33.74205485167219, 52.8734582803278, 49.01569488056406};
- assertListEquals(expectedMean, mean, EPS);
- assertListEquals(expectedDev, stddev, EPS);
+ assertArrayEquals(expectedMean, mean.toArray(null), EPS);
+ assertArrayEquals(expectedDev, stddev.toArray(null), EPS);
}
public void testMeanStdDevMatMatMatMat() {
Mat mask = gray0.clone();
submat = mask.submat(0, mask.rows() / 2, 0, mask.cols() / 2);
submat.setTo(new Scalar(1));
- List<Double> mean = new ArrayList<Double>();
- List<Double> stddev = new ArrayList<Double>();
+ CvVectorDouble mean = new CvVectorDouble();
+ CvVectorDouble stddev = new CvVectorDouble();
Core.meanStdDev(grayRnd, mean, stddev, mask);
- List<Double> expectedMean = Arrays.asList( new Double[] {33d} );
- List<Double> expectedDev = Arrays.asList( new Double[] {0d} );
+ double expectedMean[] = new double[] {33d};
+ double expectedDev[] = new double[] {0d};
- assertListEquals(expectedMean, mean, EPS);
- assertListEquals(expectedDev, stddev, EPS);
+ assertArrayEquals(expectedMean, mean.toArray(null), EPS);
+ assertArrayEquals(expectedDev, stddev.toArray(null), EPS);
}
public void testMerge() {
rgba0.setTo(new Scalar(10, 20, 30, 40));
List<Mat> src = Arrays.asList(rgba0);
List<Mat> dst = Arrays.asList(gray3, gray2, gray1, gray0, getMat(CvType.CV_8UC3, 0, 0, 0));
- List<Integer> fromTo = Arrays.asList(
- 3, 0,
+ CvVectorInt fromTo = new CvVectorInt(1, new int[]
+ { 3, 0,
3, 1,
2, 2,
0, 3,
2, 4,
1, 5,
- 0, 6);
+ 0, 6 }
+ );
Core.mixChannels(src, dst, fromTo);
public void testPolylinesMatListOfListOfPointBooleanScalar() {
Mat img = gray0;
- List<List<Point>> polyline = new ArrayList<List<Point>>();
- polyline.add(Arrays.asList(new Point(1, 1), new Point(7, 1), new Point(7, 6), new Point(1, 6)));
+ List<CvVectorPoint> polyline = new ArrayList<CvVectorPoint>();
+ polyline.add(new CvVectorPoint(new Point(1, 1), new Point(7, 1), new Point(7, 6), new Point(1, 6)));
Core.polylines(img, polyline, true, new Scalar(100));
public void testPolylinesMatListOfListOfPointBooleanScalarInt() {
Mat img = gray0;
- List<List<Point>> polyline = new ArrayList<List<Point>>();
- polyline.add(Arrays.asList(new Point(1, 1), new Point(7, 1), new Point(7, 6), new Point(1, 6)));
+ List<CvVectorPoint> polyline = new ArrayList<CvVectorPoint>();
+ polyline.add(new CvVectorPoint(new Point(1, 1), new Point(7, 1), new Point(7, 6), new Point(1, 6)));
Core.polylines(img, polyline, true, new Scalar(100), 2);
public void testPolylinesMatListOfListOfPointBooleanScalarIntIntInt() {
Mat img = gray0;
- List<List<Point>> polyline1 = new ArrayList<List<Point>>();
- polyline1.add(Arrays.asList(new Point(1, 1), new Point(7, 1), new Point(7, 6), new Point(1, 6)));
- List<List<Point>> polyline2 = new ArrayList<List<Point>>();
- polyline2.add(Arrays.asList(new Point(2, 2), new Point(14, 2), new Point(14, 12), new Point(2, 12)));
+ List<CvVectorPoint> polyline1 = new ArrayList<CvVectorPoint>();
+ polyline1.add(new CvVectorPoint(new Point(1, 1), new Point(7, 1), new Point(7, 6), new Point(1, 6)));
+ List<CvVectorPoint> polyline2 = new ArrayList<CvVectorPoint>();
+ polyline2.add(new CvVectorPoint(new Point(2, 2), new Point(14, 2), new Point(14, 12), new Point(2, 12)));
Core.polylines(img, polyline1, true, new Scalar(100), 2, Core.LINE_8, 0);