Skip to main content

libSGM

C++ implementation of Semi-Global Matching (SGM) algorithm that is wrapped with cython to provide a libsgm python module.

SGM references this work is based upon:

  • [H. Hirschmuller, "Stereo Processing by Semiglobal Matching and Mutual Information," in IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 30, no. 2, pp. 328-341, Feb. 2008. doi: 10.1109/TPAMI.2007.1166]
  • [Ernst, Ines & Hirschmüller, Heiko. (2008). Mutual Information Based Semi-Global Stereo Matching on the GPU. Proceedings of the International Symposium on Visual Computing. 5358. 10.1007/978-3-540-89639-5_22.]
  • [Hirschmüller, Heiko & Buder, Maximilian & Ernst, Ines. (2012). Memory Efficient Semi-Global Matching. ISPRS Annals of Photogrammetry, Remote Sensing and Spatial Information Sciences. I-3. 10.5194/isprsannals-I-3-371-2012.]

Dependencies

Dependencies are

python, numpy, gcc

For developers, there is another one

cython

Installation

First of all, make sure numpy is already installed.

pip install numpy 

This package can be install through the following commands:

cd libsgm
pip install .

For developers,before pip command, do not forget to delete sources/sgm_wrapper.cpp file If not, pip won't use cython to generate a new .cpp file. It will use the last updated .cpp file on git repository. This may cause conflicts.

Build documentation

Make sure Doxygen, latex and dvipng is already installed

pip install exhale
pip install sphinx-rtd-theme
python setup.py build_sphinx

Documentation is built in libsgm/doc/build/html

Usage

libSGM must be used as a package :

from libSGM import sgm_wrapper

Things to know

  • Input Cost volume type

Input Cost volume type for sgm_wrapper function can be float or uint8. Actually, libSGM would be able to receive any type thanks to "template" methods. You just need to add the type you want in sgm_wrapper.pyx on ctypedef fused my_cv_type and instantiate function at the end of lib/sgm.cpp .

Python version of LibSGM

Two python versions of LibSGM are available.

They can be called like a package :

from libsgm_python.sgm_python import run_sgm
from libsgm_python.sgm_python_parall import run_sgm_parall

Or by calling the fonctions from the Entry Points python_libsgm and python_libsgm_parall

References

If you use this CNES software, please cite the following paper:

Cournet, M., Sarrazin, E., Dumas, L., Michel, J., Guinet, J., Youssefi, D., Defonte, V., Fardet, Q., 2020. Ground-truth generation and disparity estimation for optical satellite imagery. ISPRS - International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences.

Release files for libSGM 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libSGM 0.3.1
File Size Uploaded
libSGM-0.3.1.tar.gz 153.5 kB Details

Release files / libSGM-0.3.1.tar.gz

Download URL libSGM-0.3.1.tar.gz
Size 153.5 kB
Tags Source
SHA-256 checksum
How to use checksums
10c23e5c02ed3be46175487d3fbe64e6d9c945b87476031e4a86a4315cf303ad
BLAKE2b-256 checksum
How to use checksums
9598ab74813507b131de1b0df15ad64f9d403bc67f19fd248ef2466cb639133b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.9
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page