Normalize the Coordinates
Compute a similarity transformation \(T_1\) and \(T_2\) such that the centroid of the points is moved to the origin, and the maximum distance from the origin is scaled to \(\sqrt{2}\).
Formulate the Equation
For each pair of correspondences \((x_1,y_1,1)\) and \((x_2,y_2,1)\), expanding the equation \((x_2,y_2,1)^T\mathbf{F}(x_1,y_1,1) = 0\), we obtain the following expressions:
\[ x1x2F_{11}+x2y1F_{12}+x2F_{13}+y2x1F_{21}+y1y2F_{22}+y2F_{23}+x1F_{31}+y1F_{32}+F_{33}=0 \]
Combining these equations results in a linear equation for \(\mathbf{F}\).
Solve for F
Using Singular Value Decomposition (SVD) to solve for \(\mathbf{F}\), the final result is given by \(\mathbf{T_2}^T \mathbf{F} \mathbf{T_1}\).
Viewpoint 1 (Points) | Viewpoint 2 (Epipolar Lines) |
---|---|
![]() |
![]() |
Using the formula \(\mathbf{E} = \mathbf{K}_2^T \mathbf{F} \mathbf{K}_1\), we get the estimated \(\mathbf{E}\) as \[ \begin{bmatrix} -0.41524274 & -8.81748894 & -2.15055808 \\ -1.3803559 & 0.79067134 & 69.08265036 \\ -3.58890876 & -68.47438701 & 1. \end{bmatrix} \]
Formulate the Equation
After formulating the equation using the eight-point algorithm, we
apply Singular Value Decomposition (SVD) to obtain the solution space,
represented as \(<\mathbf{M}_1,
\mathbf{M}_2>\). The general solution of the linear equation
can be expressed as \(\lambda \mathbf{M}_1 +
(1 - \lambda) \mathbf{M}_2\). Next, we use the fact that the
fundamental matrix has rank two, and solve the equation \(\det(\lambda \mathbf{M}_1 + (1 - \lambda)
\mathbf{M}_2) = 0\) using
np.polynomial.polynomial.polyroots
. If there are three real
solutions, we must select the correct one. For this assignment, we
assume the epipoles lie outside the image, which helps identify the
correct solution.
Viewpoint 1 (Points) | Viewpoint 2 (Epipolar Lines) |
---|---|
![]() |
![]() |
![]() |
![]() |
We sample the minimum number of points required to estimate \(\mathbf{F}\) using the RANSAC algorithm. To determine if a correspondence pair is an inlier, we compute the sum of squared distances between the corresponding points and their estimated epipolar lines. If the error falls below a predefined threshold, the pair is classified as an inlier.
Viewpoint 1 (Points) | Viewpoint 2 (Epipolar Lines) | % of inliers vs. # of iterations |
---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
For a 3D point \(\mathbf{x} = (x, y, z)\) with its projection on the image plane at ((u, v)), we have the constraint \((\mathbf{P} (x, y, z)^T) \times (u, v)^T = 0\). This allows us to formulate a \(4 \times 3\) matrix \(\mathbf{A}\) such that \(\mathbf{A} \mathbf{x} = 0\). The solution to this linear system can then be obtained using singular value decomposition (SVD).
Multi-view images | Output |
---|---|
![]() |
![]() |
![]() |
![]() |
We use cv2.ORB_create
to extract features and
cv2.BFMatcher
to compute potential matches. Then, we use
the RANSAC algorithm implemented in q2
to compute \(\mathbf{F}\)
Viewpoint 1 (Points) | Viewpoint 2 (Epipolar Lines) |
---|---|
![]() |
![]() |
![]() |
![]() |