Minimal Structure From Motion Example

Two view example is provided. Opencv is used for feature detection and matching as well as essential matrix estimation. However, there is code provided if you want to estimate essential matrix without opencv. Useful as a starting point for more advanced projects.

Code is provided for:

  • fundamental matrix estimation (RANSAC)
  • essential matrix from fundamental matrix (with normalization)
  • extract realizable relative pose from essential matrix
  • mid-point triangulation
  • camera matrices
  • visualization

SFM_Example_views Two Undistorted Views obtained from: https://www.mathworks.com/help/vision/ug/structure-from-motion-from-two-views.html

SFM_Example

Point cloud obtained from above views with camera positions

Requirements

Not hard version requirements, just what I used.

  • python 3.9
  • opencv 4.7
  • numpy
  • pyplot for visualization

Usage

python main.py

*Might take a while. If taking too long, reduce number of detected keypoints in applications/sfm.py