Giter VIP home page Giter VIP logo

openvslam-python-bindings's Introduction

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.

openvslam-python-bindings's People

Contributors

alejandrosilvestri avatar

Stargazers

dubing avatar Slávek Zbirovský avatar  avatar Sidney Trzepacz avatar Sohee avatar  avatar  avatar

Watchers

 avatar

Forkers

squiro flyinggh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.