Skip to content

Commit da75d12

Browse files
committed
java: fix Calib3d test
1 parent 8e22b17 commit da75d12

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

modules/java/android_test/src/org/opencv/test/calib3d/Calib3dTest.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,22 @@ public void testFindFundamentalMatListOfPointListOfPoint() {
249249

250250
Mat fm = Calib3d.findFundamentalMat(pts, pts);
251251

252-
truth = new Mat(3, 3, CvType.CV_64F);
253-
truth.put(0, 0, 0, -0.577, 0.288, 0.577, 0, 0.288, -0.288, -0.288, 0);
254-
assertMatEqual(truth, fm, EPS);
252+
// Check definition of fundamental matrix:
253+
// [p2; 1]T * F * [p1; 1] = 0
254+
// (p2 == p1 in this testcase)
255+
for (int i = 0; i < pts.rows(); i++)
256+
{
257+
Mat pt = new Mat(3, 1, fm.type());
258+
pt.put(0, 0, pts.get(i, 0)[0], pts.get(i, 0)[1], 1);
259+
260+
Mat pt_t = pt.t();
261+
262+
Mat tmp = new Mat();
263+
Mat res = new Mat();
264+
Core.gemm(pt_t, fm, 1.0, new Mat(), 0.0, tmp);
265+
Core.gemm(tmp, pt, 1.0, new Mat(), 0.0, res);
266+
assertTrue(Math.abs(res.get(0, 0)[0]) <= 1e-6);
267+
}
255268
}
256269

257270
public void testFindFundamentalMatListOfPointListOfPointInt() {

0 commit comments

Comments
 (0)