Ask Your Question

# How to use five-point.cpp

Hi there,

I notice a nice little function has appeared in opencv : five-point.cpp. However I can't figure how to use the various functions inside. Is there an example available ? If the functions are not mature yet, I would be glad to test them.

Best regards,

Guido

edit retag close merge delete

## Comments

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.

## 2 answers

Sort by » oldest newest most voted

the public declaration of the functions is in calib3d.hpp, so no problem accessing them.

docs ? hmm. found none ( maybe they're just waiting for you to write them ? )

findFundamentalMat is used in the stereocalibration samples, and there's some testcode

more

## Comments 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:

1. p1: points of the image 1 (vector<point2f> or Mat)
2. p2: points of the image 2 (vector<point2f> or Mat)
3. focal: focal distance (double), it is the element (0,0) of your intrinsic parameters matrix.
4. pp: principal point (Point2d), this vector must have the elements (0,2) and (1,2) of the intrinsic parameters matrix.
5. method: in this case it could be RANSAC or LMeDS (similar to findFundamentalMat)
6. probability of success: usually 0.99
7. error: this value is the threshold used in RANSAC to determine if a match is considered an outlier or an inlier
8. 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);

more

## Comments

Thank you for this documentation. Do you think you could manage to get this on the opencv site ?

Official site

GitHub

Wiki

Documentation

## Stats

Asked: 2013-07-26 07:27:27 -0500

Seen: 1,821 times

Last updated: Jul 26 '13