Pythonic implementation of an ORB feature matching based Monocular-vision SLAM.
Simultaneous Localization and Mapping (SLAM) has been there for quite a while, but it has gained much popularity with the recent advent of Autonomous Navigation and self-driving cars. SLAM is like a perception that aids a robot/device to find it's relative position in an unknown environment. Applications of which extend from Augmented Reality, virtual reality, indoor navigation and Autonomous vehicles.
This section should list any major frameworks that you built your project using. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.
The application begins with calibrating the camera and setting the camera intrinsic for optimization. It makes use of OpenCV's ORB feature mapping function for key-point extraction. Lowe's ratio test is used for mapping the key-points. Each detected key-point from the image at '(t-1)' interval is matched with a number of key-points from the 't' interval image. The key-points with the least distance is kept based on the several generated. Lowe's test checks that the two distances are sufficiently different. If they are not, then the key-point is eliminated and will not be used for further calculations. For 2D video visualization, I had a couple of choices: OpenCV, SDL2, PyGame, Kivy, Matplotlib, etc. Turns out OpenCV's imshow function might not be the best choice. The application made use of SDL2, matplolib and kivy's video playing libraries but PyGame was outperformed all of them. Thus, I used PyGame for visualizing the detected keypoints and various other information such as orientation, direction and speed.
For 3D visualization, Pangolin was the best option due to various reasons such as:
- Supports python and it's opensource!
- Uses simple OpenGL at its fundamental form
- Provides Modularized 3D visualization For implementing a graph-based non-linear error function, the project leverages the python wrapper of G2O library. G2O is an open-source optimization library that helps reduce the Gaussian Noise from nonlinear least squares problems such as SLAM.
This is an example of how to list things you need to use the software and how to install them.
- OpenCV 4
pip3 install opencv-python
- PyGame
python3 -m pip install -U pygame --user
- NumPy
pip3 install numpy
- g2oPy
- Pangolin
- Clone the repository:
git clone https://github.com/Akbonline/SLAMPy-Monocular-SLAM-implementation-in-Python.git
- Running the algorithm on a video
python3 slam.py <test-video.mp4>
There is one test video included in the repo.
- To run the test video
python3 slam.py test.mp4
The output should look something like this:
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
- Akshat Bajpai - My Portfolio
- Email: akshatbajpai.biz@gmail.com
- Project Link: https://github.com/Akbonline/SLAMPy-Monocular-SLAM-implementation-in-Python
- My LinkedIn: linkedin-url: (linkedin.com/in/akshat-bajpai)
- My GitHub: linkedin-url: (https://github.com/Akbonline)