4

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

Epipolar image

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

Hamid Bazargani
  • 847
  • 1
  • 15
  • 30
  • Actually this is a mathematical question ;) – Tomasz Lenarcik Apr 01 '14 at 08:19
  • In theory, the fundamental matrix should be of rank 2 and it's kernel (both right and left) is just the epipole. So if your formula for `H` is correct the problem boils down to finding the kernel of `F`. Of course, since the matrix is probably computed from some real-world measurements, the rank will always be 3, so you should to use something like the **SVD** decomposition to find the eigenvector corresponding to the smallest eigenvalue (closest to zero), and you're good to go. – Tomasz Lenarcik Apr 01 '14 at 08:41
  • Your epiline notation is confusing, because `e` usually denotes the epipole. You should use `l` for an epiline. – BConic Apr 01 '14 at 11:34
  • @AldurDisciple I'm not sure about `e` neither. that's why I provided a link to the reference I used. If that is epipole, how should I compute and use it. – Hamid Bazargani Apr 01 '14 at 18:21

1 Answers1

1

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 of F_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 by cv::findHomography, but in general this will not be the case for the homography obtained using the method above.

BConic
  • 8,750
  • 2
  • 29
  • 55
  • Thanks for your response. The notation is now clear for me. The question is that is this method sensible for finding `H`? The reason for using `F` rather than directly computing `H` is that I want to relax non-planarity to some extent. I know it is possible to retrieve `H` from `F` but I could not find an implementation so far. – Hamid Bazargani Apr 01 '14 at 18:31
  • @HamidBazargani unfortunately you cannot relax non-planarity for homographies when mapping from one image to another (unless they are acquired from the same optical center). You can derive the homography for any plane you like, but there is always one, even if its not easy to see which one. If you want to register two images more accurately, you should have a look at optical-flow and/or dense stereo matching techniques. – BConic Apr 01 '14 at 18:56