Skip to content

Optimum frame selection for 3D reconstruction from video

Notifications You must be signed in to change notification settings

razekmh/3D-from-video

Repository files navigation

3D from video

3D-from-video

Optimum frame selection for 3D reconstruction from video

APM PowerShell Gallery GitHub Pipenv locked Python version

Table of Contents

Prerequisites

  • python 3.*
  • opencv 3.4.2.16
  • opencv-contrib 3.4.2.16
  • pandas > 0.25.*

You can install the libraries individually or using the requiremnts.txt included in the repository.

Installation

  • first clone the repository
git clone https://github.com/razekmh/3D-from-video.git
  • then install the requirements if not already installed
pip install -r requirement.txt

Features

  • Produces a folder with extracted frames for each video
  • Parses a folder of videos on one go
  • Supports three different methodologies and four varieties of algorithms

Usage

To use the modules, you will need at least one video file. Start by placing the video in a folder and keep track of the directory as you will need it in using each of the modules. The default directory for the videos is a folder tilted videos in the same directory as the modules is saved. If you choose to save your videos in such folders, then you don't need to pass the directory argument to the module while running it. In all the modules the directory argument can be passed using -d as in example below

python vo_main.py -d directory

The modules also assume that the video extension is MOV unless you specify the extension in the arguments. In all the modules the extension argument can be passed using -ex as in example below

python vo_main.py -ex extension

The algorthim provides four main options

Baseline

This option allows you to extract frames from video on regular intervales. It is included in the module nth_main.py. The modules also assume that the intervales are 25 frames unless you specify it in the arguments. The interval argument can be passed using -nth as in example below

python nth_main.py -nth interval

The included arguments are:

  • -d : videos directory
  • -ex : videos extension
  • -nth : frame interval

SIFT

This option allows you to extract frames based on feature displacement algorithm while using SIFT detector and BruteForce matcher. It is included within the module fd_main.py. To use SIFT you need to specify the -fd argument by typing SIFT as in the example below

python fd_main.py -fd SIFT

The included arguments are:

  • -d : videos directory
  • -ex : videos extension
  • -fd : Feature detection algorthim

ORB

This option allows you to extract frames based on feature displacement algorithm while using ORB detector and FLANN matcher. It is included within the module fd_main.py. To use SIFT you need to specify the -fd argument by typing ORB as in the example below

python fd_main.py -fd ORB

The included arguments are:

  • -d : videos directory
  • -ex : videos extension
  • -fd : Feature detection algorthim

Odometry

This option allows you to extract frames based on visual odometry algorithm. It is included within the module vo_main.py. It requires more parameters to operate properly. The additional parameters should be provided in the for of a xml file titled after the video with _camera_calibration.xml trailing after, as in the following example

video_name_camera_calibration.xml

The structure and information included in the video calibration are included in an example file here

If the xml file is not provided, the module will set the camera calibration parameters to zeros and will estimate the focal length based on the video dimensions which will impact the quality of the results.

The included arguments are:

  • -d : videos directory
  • -ex : videos extension

Output

All modules will export the selected frames in a folder named after the video with a suffix pointing to the module/algorithm used. Additionally basic statistics will be exported in simple text file.

Theory

Study outline

Contributing

To get started...

Step 1

  • Show ❤️! ⭐️ the repository

Step 2

  • Option 1

    • 🍴 Fork this repo!
  • Option 2

    • 👯 Clone this repo to your local machine using https://github.com/razekmh/3D-from-video.git

Step 3

  • HACK AWAY! 🔨🔨🔨

Step 4

Team

References:

Parts of the code are modified after:

Readme is modified after:


About

Optimum frame selection for 3D reconstruction from video

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages