# Wrong Epipolar lines, No Visual sanity

Hi, I've tried using the code given https://docs.opencv.org/3.2.0/da/de9/... to find the epipolar lines, but instead of getting the output given in the link, I am getting the following output.

but when changing the line F, mask = cv2.findFundamentalMat(pts1,pts2,cv2.FM_LMEDS) to F, mask = cv2.findFundamentalMat(pts1,pts2,cv2.FM_RANSAC) i.e: using RANSAC algorithm to find Fundamental matrix instead of LMEDS this is the following output.

When the same line is replaced with F, mask = cv2.findFundamentalMat(pts1,pts2,cv2.FM_8POINT) i.e: use eight point algorithm this is the following output.

All of the above about output does not have any visual sanity nor anyway near to close to the given output in opencv documentation for finding epipolar lines. But ironically, if the same code if executed by changing the algorithm to find fundamental matrix in this particular sequence

1. FM_LMEDS
2. FM_8POINT
3. FM_7POINT
4. FM_LMEDS

most accurate results are generated. This is the output.

I thought we are suppose to get the above output in one run of any of the algorithm (with the variations in matrix values and error). Am I running the code incorrectly? What is that I've to do, to get the correct epipolar lines (i.e.; visually sane)? I am using opencv version 3.3.0 and python 2.7. Looking forward for reply. Thank you.

edit retag close merge delete

## Comments

maybe it is about you always give different points to match(to calculate fundamental matrix) you should try it for the same points. By the way getting different keypoints for the same image is interesting.

( 2019-01-02 01:18:04 -0500 )edit