3D Reconstruction from two 2D images 

Image 1 for 3d reconstruction
Image 2 for 3d reconstruction

Reconstructed the scene from two images (shown above) using the SIFT matchings. The SIFT descriptors are simply computed and matched using OpenCV.

SIFT features for image 1
SIFT features for image 2

RANSAC estimation: The estimation of E can be made much more robust by selecting sets of points that reach a common agreement (eliminating outliers or spurious matchings) and obtain a better estimate of E. The epipolar lines are drawn using the essential matrix E (for calibrated points).

Keypoint matching between two images

To recover the transformation R, T between the two cameras, SVD decomposition of E is done. For a given estimate of E, there are two possible solutions for (T, R) due to the twisted pair ambiguity. So there are four possible solutions for (R, T), considering twisted pair ambiguity of E and -E.

RANSAC Inlier Matches
Epipolar lines

Then triangulation is done to check whether a given candidate pair of (R, T) is the correct transformation (one out of the four candidates). This is one by  picking the candidate that has the highest number of reconstructed points in front of both the cameras

Code: click here