decadenza / SimpleStereo

Stereo vision made Simple
GNU General Public License v3.0
40 stars 15 forks source link
computer-vision opencv python stereo-calibration stereo-matching stereo-vision stereoscopy

SimpleStereo

Stereo vision made Simple.

SimpleStereo is a high level framework for stereo vision applications. It is written in Python 3, with C++ extensions. Documentation is available at https://decadenza.github.io/SimpleStereo/

Dependencies

Installation

Before starting, be sure to have the latest setuptools package by running pip install --upgrade setuptools. Then proceed with one of the two options below.

Option 1

Install package from PyPI with:

pip3 install simplestereo

Option 2

Clone or download the latest version and unzip. Then, from the folder containing setup.py, run:

pip3 install .

Troubleshooting

I am aware of some issues while installing SimpleStereo. If you have errors during installation, please open an issue.

Windows users troubleshooting

If during installation you get, together with other messages, the following error:

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

Please install the Microsoft C++ Build Tools as indicated. These are required to build C++ extensions that are part of SimpleStereo. More information about compiling on Windows is available at https://wiki.python.org/moin/WindowsCompilers.

Basic example

SimpleStereo helps you with common tasks. You can calibrate two cameras and initialise a stereoRig with:

import simplestereo as ss

# Path to your images
images = [
    ("0_left.png", "0_right"),
    ("1_left.png", "1_right"),
    ("2_left.png", "2_right"),
    ...
    ]

# Calibrate and build StereoRig object
rig = ss.calibration.chessboardStereo( images, chessboardSize=(7,6), squareSize=60.5 )

# Save rig object to file
rig.save("myRig.json")

# Optionally print some info
print("Reprojection error:", rig.reprojectionError)
print("Centers:", rig.getCenters())
print("Baseline:", rig.getBaseline())

More examples available in the examples folder.

Features

General

Calibration algorithms

Stereo rectification algorithms

Passive stereo matching algorithms

Active and Structured light algorithms

Unwrapping algorithms

Documentation

Documentation follows numpydoc style guide.

Install documentation prerequisites with:

pip install Sphinx numpydoc

Build documentation with:

cd sphinx-documentation-generator
sh BUILD_SCRIPT.sh
cd ..

Future work

Contributions

Reporting issues and proposing integrations of other stereo vision algorithms is highly encouraged and it will be acknowledged. Please share your issues!