ItsWajdy / modeler

A Python package to reconstruct 3D models from video
MIT License
48 stars 16 forks source link
3d-reconstruction computer-vision opencv opencv-python python python3 sfm structure-from-motion

modeler

A simple package to reconstruct a 3D model of an object from a video taken for that object

Prerequisites

This package uses Python 3.x

Also, you'll need OpenCV and numpy which can be downloaded using the following commands

pip install numpy
pip install opencv-python

Installation

To install modeler simply run this command from the command line:

pip install modeler

Or

pip install git+git://github.com/Wajdy759/modeler.git#egg=modeler

Then you can import it using:

import modeler

Usage

modeler has a module called SfM which handles wraps everything you'll need

sfm = SfM(results_dir, video_already_converted, video_path, video_sampling_rate)

Where:

To actually run the algorithm and get the 3D model you'd use

sfm.find_structure_from_motion()

Example

from modeler import SfM

sfm = SfM('results/', False, 'videos/vid1.mp4', 27)
sfm.structure_from_motion()

When the progrm terminates you'll get a set of .ply files in the folder named results

References

This project was heavily inspired by this article https://www.researchgate.net/publication/265190880_3D_reconstruction_from_multiple_images