Commit c4dd35ab authored by Jay's avatar Jay
Browse files

Failure to compute F now fails gracefully

parent 2871311f
Loading
Loading
Loading
Loading
+1 −2
Changes for autocnet/graph/edge.py: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -58,12 +58,10 @@ class Edge(dict, MutableMapping):
        for k, v in d.items():
            if isinstance(v, pd.DataFrame):
                if not v.equals(o[k]):
                    print('E', k, self.source['node_id'], self.destination['node_id'])
                    eq = False
            elif isinstance(v, np.ndarray):
                if not v.all() == o[k].all():
                    eq = False
                    print('E2', k)
        return eq

    @property
@@ -166,6 +164,7 @@ class Edge(dict, MutableMapping):

        self['fundamental_matrix'], fmask = fm.compute_fundamental_matrix(s_keypoints, d_keypoints, **kwargs)

        if self['fundamental_matrix'] != None:
            # Convert the truncated RANSAC mask back into a full length mask
            mask[mask] = fmask

+3 −0
Changes for autocnet/matcher/add_depth.py: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -46,6 +46,9 @@ def deepen_correspondences(ab_kp, bc, source_idx,
    # Grab F for reprojection
    f_matrix = bc['fundamental_matrix']

    if f_matrix is None:
        return None, None

    # Compute the epipolar line projecting point ab into bc
    epipolar_line = normalize_vector(ab_kp.dot(f_matrix.T))

+3 −2
Changes for autocnet/transformation/fundamental_matrix.py: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -167,9 +167,10 @@ def compute_fundamental_matrix(kp1, kp2, method='mle', reproj_threshold=2.0,
                                     param1=reproj_threshold,
                                     param2=confidence)


    if F.shape != (3,3):
        warnings.warn('F computation fell back to 7-point algorithm and returned 3 F matrices.')
        return
        warnings.warn('F computation fell back to 7-point algorithm, not setting F.')
        return None, None
    # Ensure that the singularity constraint is met
    F = enforce_singularity_constraint(F)

+1 −1
Changes for functional_tests/test_three_image.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ class TestThreeImageMatching(unittest.TestCase):
        for i, node, in cg.nodes_iter(data=True):
            self.assertIn(node.nkeypoints, range(490, 511))

        cg.match(k=5)
        cg.match(k=2)
        cg.symmetry_checks()
        cg.ratio_checks()