Java API: new converters, findFundamentalMat/cornerSubPix/findHomography/solvePnP/solvePnPRansac and their tests are updated

This commit is contained in:
Andrey Pavlenko
2011-08-02 13:10:23 +00:00
parent ce2f4c6a4d
commit f4e28f87d8
6 changed files with 289 additions and 61 deletions

View File

@@ -261,7 +261,7 @@ public class calib3dTest extends OpenCVTestCase {
pts2.add(new Point(x, y));
}
Mat fm = Calib3d.findFundamentalMat(Converters.vector_Point2f_to_Mat(pts1), Converters.vector_Point2f_to_Mat(pts2));
Mat fm = Calib3d.findFundamentalMat(pts1, pts2);
truth = new Mat(3,3,CvType.CV_64F);
truth.put(0, 0, 0, -0.5, -0.5, 0.5, 0, 0, 0.5, 0, 0);
@@ -296,9 +296,7 @@ public class calib3dTest extends OpenCVTestCase {
transformedPoints.add(new Point(y, x));
}
Mat hmg = Calib3d.findHomography(
Converters.vector_Point2f_to_Mat(originalPoints),
Converters.vector_Point2f_to_Mat(transformedPoints));
Mat hmg = Calib3d.findHomography(originalPoints, transformedPoints);
truth = new Mat(3, 3, CvType.CV_64F);
truth.put(0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1);
@@ -543,9 +541,7 @@ public class calib3dTest extends OpenCVTestCase {
Mat rvec = new Mat();
Mat tvec = new Mat();
Calib3d.solvePnP(Converters.vector_Point3f_to_Mat(points3d),
Converters.vector_Point2f_to_Mat(points2d), intrinsics,
new Mat(), rvec, tvec);
Calib3d.solvePnP(points3d, points2d, intrinsics, new Mat(), rvec, tvec);
Mat truth_rvec = new Mat(3, 1, CvType.CV_64F);
truth_rvec.put(0, 0, 0, Math.PI / 2, 0);

View File

@@ -554,9 +554,7 @@ public class imgprocTest extends OpenCVTestCase {
Size zeroZone = new Size(-1, -1);
TermCriteria criteria = new TermCriteria(2/*TODO: CV_TERMCRIT_EPS*/, 0, 0.01);
Mat cornersMat = Converters.vector_Point2f_to_Mat(corners);
Imgproc.cornerSubPix(img, cornersMat, winSize, zeroZone, criteria);
Converters.Mat_to_vector_Point(cornersMat, corners);
Imgproc.cornerSubPix(img, corners, winSize, zeroZone, criteria);
assertPointEquals(truthPosition, corners.get(0), weakEPS);
}