def test_essential_five_points(one_pair_and_its_E): f1, f2, E, _ = one_pair_and_its_E result = pygeometry.essential_five_points(f1[0:5, :], f2[0:5, :]) # run over the N solutions, looking for the exact one for E_found in result: if E_found[0, 0]*E[0, 0] < 0.: E_found *= -1.0 good_det = np.linalg.det(E_found) < 1e-10 is_exact = np.linalg.norm(E-E_found, ord='fro') < 1e-6 if good_det and is_exact: exact_found = True assert exact_found
def test_essential_five_points(pairs_and_their_E): exact_found = 0 for f1, f2, E, _ in pairs_and_their_E: result = pygeometry.essential_five_points(f1[0:5, :], f2[0:5, :]) # run over the N solutions, looking for the exact one for E_found in result: if E_found[0, 0] * E[0, 0] < 0.0: E_found *= -1.0 good_det = np.linalg.det(E_found) < 1e-10 is_exact = np.linalg.norm(E - E_found, ord="fro") < 1e-6 exact_found += good_det and is_exact exacts = len(pairs_and_their_E) - 2 assert exact_found >= exacts