Skip to content

compute_fundamental()'s A matrix might be reversed #4

Description

@drojf

I noticed that in sfm_test.py, calls to compute_fundamental() and compute_fundamental_normalized() have their input variables reversed (x2 then x, instead of x then x2):

E = sfm.compute_fundamental(self.x2[:, :8], self.x[:, :8])

E = sfm.compute_fundamental_normalized(self.x2[:, :8], self.x[:, :8])

See sfm_test.py, around line 33

Comparing the definition of A to the one in "Multiple View Geometry in Computer Vision, Second Edition", section 11.1 and the Wikipedia page, it appears that x1 and x2 have been swapped. Reversing the values allows the normal order of arguments to be used.


The original definition of A is:

A[i] = [x1[0, i] * x2[0, i],  x1[0, i] * x2[1, i],  x1[0, i] * x2[2, i],
        x1[1, i] * x2[0, i],  x1[1, i] * x2[1, i],  x1[1, i] * x2[2, i],
        x1[2, i] * x2[0, i],  x1[2, i] * x2[1, i],  x1[2, i] * x2[2, i],
       ]

The fixed definition of A swaps every occurrence of x1 and x2:

A[i] = [x2[0, i] * x1[0, i],  x2[0, i] * x1[1, i],  x2[0, i] * x1[2, i],
        x2[1, i] * x1[0, i],  x2[1, i] * x1[1, i],  x2[1, i] * x1[2, i],
        x2[2, i] * x1[0, i],  x2[2, i] * x1[1, i],  x2[2, i] * x1[2, i],
       ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions