I'm trying to compute Homography matrix H
given a set of correspondences and the Fundamental matrix F
.
From the principle of Epipolar geometry I know this can be done by cross product of epiline and F
from Epipole Geometry
[e_ij] x F_ij = H_ij
I'm using OpenCV
for finding Fundamental matrix F
from set of matches between two views using cv::findFundamentalMat()
.
My question is that how can I find e_ij
and how to use it in order to compute H
. In OpenCV
there is a function cv::computeCorrespondEpilines()
that finds epilines corespond to each given point.
It's worth mentioning that I'm not interested in computing H
directly from set of matches but only from computed Fundamental matrix.
Thanks
First, notice that the equation (C29) you mentioned from your link uses a line l with same coordinates as eij, which is the epipole in image j. Therefore, l=eij is not an epiline, since dot( eij , eij ) == norm(eij)² == 1 != 0.
If I stick to the notations given in your link, you can compute the epipole eij as the left null-vector of Fij. You can obtain it by calling
cv::SVD::solveZ
on the transpose ofF_ij
. Then, as is mentioned in your link, the homography Hij (which maps points from image i to image j) can be computed as Hij = [eij]x Fij, where the notation [eij]x refers to the 3x3 skew-symmetric operator. A definition of this notation can be found in the Wikipedia article on cross-product.However, be aware that such an homography Hij defines a mapping from image i to image j via the plane backprojected from image j using the line with same coordinates as eij. In general, this will give a result which is very different from the result returned by
cv::findHomography
, where the resulting homography is a mapping from image i to image j via the dominant plane in the observed scene. Hence, you will be able to approximately register the two images using the homography returned bycv::findHomography
, but in general this will not be the case for the homography obtained using the method above.