five-point.cpp is the file that provides functions to calculate the Essential matrix (a special case of the Fundamental matrix) using the five point algorithm.
The findEssentialMat function is similar to findFundamentalMat, the difference is that you require the intrinsic parameters of your camera (calculated from calibration). You need to provide the following:
- p1: points of the image 1 (vector<point2f> or Mat)
- p2: points of the image 2 (vector<point2f> or Mat)
- focal: focal distance (double), it is the element (0,0) of your intrinsic parameters matrix.
- pp: principal point (Point2d), this vector must have the elements (0,2) and (1,2) of the intrinsic parameters matrix.
- method: in this case it could be RANSAC or LMeDS (similar to findFundamentalMat)
- probability of success: usually 0.99
- error: this value is the threshold used in RANSAC to determine if a match is considered an outlier or an inlier
- output: a matrix that contains ones and zeros, indicates which correspondences are outliers using a zero and inliers using a one.
Example:
Mat essential = findEssentialMat(p1,p2,focal,pp,RANSAC,0.99,1,output);
The 5-Point algorithm returns 10 solutions for E. I am facing this problem as I am trying to implement this algorithms for my academic project. 1. Which Matrix out of the 10 solutions to be choosen as the Essential Matrix. What's the criteria for that? 2. How to generalize the 5-point algorithm for more than 5 points(RANSAC inliers) for final Motion Estimation. Thank you in advance for any help in this issue.
with best regards, Durga Prasad.