nbarba / py3DRec

3D modeling from uncalibrated images
MIT License
94 stars 29 forks source link
3d-modelling 3d-reconstruction epipolar-geometry multiple-view-geometry structure-from-motion

py3DRec

This repository contains a revised implementation of the structure from motion algorithm used in Barbalios et al., "3D Human Face Modelling From Uncalibrated Images Using Spline Based Deformation", VISSAP 2008. Given at least three views of an object, and identified feature points across these views, the algorithm generates a 3D reconstruction of the object.

Overview

The algorithm takes a series of features (i.e. 2D coordinates), tracked through a sequence of images (i.e. taken with a common handheld camera), and returns the 3D coordinates of these features in the metric space. To make this happen, the algorithm consists of the following steps:

Note: The algorithm used in the above referenced paper included an additional step, where the 3D points were used to deform a generic face model.

Overview

Prerequisites

The following python packages are required to run the projet:

Usage

Code Structure

The code consists of four classes, each one designed for a specific task:

Example

A toy-example is provided in the examples folder. It is a sequence of pictures of a poster on a wall (3 images). The 2D features were automatically selected using the SIFT algorithm, and are given in a txt file that has the following format: | x coordinates | y coordinates | feature id | image id |.

To run the example, use the following command:

python uncalibrated_rec.py --input_file=./example/features_poster.txt --show

The first argument (i.e. --input_file) defines the txt file with the features, the second flag (--show) displays the image sequence together with the 2D features (remove this argument to not show the sequence).

After the algorithm is executed, two files should be generated:

License

This project is licensed under the MIT License - see the LICENSE.md file for details