Skip to content

AlejandroSilvestri/OpenVSLAM-Python-bindings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenVSLAM-Python-bindings

Python bindings for OpenVSLAM, an ORB based visual SLAM similar to ORB-SLAM2.

By compiling the provided cpp file, you get the module openvslam that let you control openvslam'system from Python. OpenVSlam must be already installed in your system. You'll be able to run openvslam, load & save maps, feed images and get the pose matrix.

Right now no bindings for viewers are provided, so do not expect to see the 3D map nor the features over the image.

OpenVSLAM supported versions

These bindings should work with the original OpenVSLAM, OpenVSLAM community fork and Stella-vslam until version 0.21 March 21. Stella-vslam version 0.22 changed the API rendering these bindings unusable. Proper bindings for that version and on are provided at Stella-vslam Python bindings repo.

Building the bindings

In order to get a openvslam module you can import from Python, you need to:

  • install OpenVSLAM
  • install PyBind11
    • like pip install pybind11
  • compile openvslam-bindings.cpp

This is an example of command line compilation in Linux:

/usr/bin/g++ -O3 -Wall -shared -std=c++11 -fPIC $(python3 -m pybind11 --includes) -I/usr/local/include/openvslam/3rd/json/include -DUSE_DBOW2 /home/user/OpenVSLAM-Python-bindings/openvslam_bindings.cpp -o openvslam$(python3-config --extension-suffix) -lopenvslam

In this command line you can remove -DUSE_DBOW2 if you don't want to use DBoW2, and use fbow instead.

The result is a module in a form of a shared library, like

openvslam.cpython-38-x86_64-linux-gnu.so

You can import this module in your Python code simply like

import openvslam

provided the module file is reachable, for example being in the working directory.

Testing the module

In order to run openvslam you always need a configuration file and a vocabulary file. You can get the vocabulary orb_vocab.dbow2 file from openvslam.

Two tests are available in Python.

test1.py is a minimal proof of operation, it starts and shuts down openvslam. A random config.yaml file is provided in this project to facilitate this test. Don't rest until you get this test running without errors.

test2.py is a more complete demo, inspired in run_video_slam example. You'll need a video with the right config.yaml. You can download them from the datasets openvslam made public. Here are the direct links:

Each zip contains a video and the appropiate config.yaml.

What is in the module

openvslam module contains two clases: config and system. The former is only used to pass config.yaml to system initialization. You do all the work with a system object.

At the end of openvslam_binding.cpp you'll find the list of bound functions accessible from Python. Tests serve as example of use.

License

3-clause BSD license (see LICENSE)

This project uses code from the following third party libraries:

Thanks

Many thanks to Jack Cai whose non appropiable code inspired this project.

Help needed

All help is welcome to facilitate installation with cmake. From cmakelists.txt to the documentation with examples of use. We can communicate through Dicussions.

About

Python bindings for OpenVSLAM, an orb based visual SLAM similar to ORB-SLAM2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published