Git Product home page Git Product logo

structure_from_motion's Introduction

CI License: GPL v3

Structure From Motion From Scratch

Basic SFM implementation "from scratch", using only basic linear algebra support from numpy. Based on the Challenge Question in section 4.8 in Introduction to Autonomous Mobile Robots, Second Edition .

Algorithm steps

The implemented algorithm follows the following steps.

Given: two images of the same scene taken from slightly different perspectives. Then:

  1. Detect corners in both images using the Harris corner detector.
  2. Match corners using descriptors calculated by Squared Sum of Differences. Use cross-check and ratio-test validation to filter out unlikely matches.
  3. Estimate a most likely Essential Matrix from the set of remaining matches. The estimation uses RANSAC with the Eight-Point Algorithm as model fitter and the Symmetric Epipolar Distance as model scorer.
  4. Decompose the Essential Matrix into rotation and translation, extracting a single possible solution using the cheriality check. Filter out matches which fail the cheirality check.
  5. Triangulate and visualize the 3D position of remaining matches.

Example illustration of feature matches which were left inliers after running RANSAC: Inlier Feature Matches after RANSAC The small blue markers show the Harris corners. Matching features are connected by colored lines.

Requirements

  • GNU Make 4.1+
  • Python 3.10 - install requirements.txt

Running demo

To run a demo on a predefined dataset:

  1. Install the Python requirements.
  2. Invoke make demo.

Note: On Mac OS the default make version is too old, please install a modern version using brew install. The new version will be available under the gmake alias.

Sources

Besides the Autonomous Mobile Robots book, I used several other sources to implement the various steps of the vision pipeline.

Essential Matrix Estimation and Decomposition

Error Measure for Essential Matrix Selection

structure_from_motion's People

Contributors

bazs avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

structure_from_motion's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.