Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Python binding of SLAM graph optimization framework g2o
| Date | Stars |
|---|---|
| 2026-07-24 | 705 |
| 2026-07-25 | 705 |
| 2026-07-28 | 705 |
| 2026-07-30 | 705 |
| 2026-08-06 | 705 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# g2opy
This is a python binding of graph optimization C++ framework [g2o](https://github.com/RainerKuemmerle/g2o).
> g2o is an open-source C++ framework for optimizing graph-based nonlinear error functions. g2o has been designed to be easily extensible to a wide range of problems and a new problem typically can be specified in a few lines of code. The current implementation provides solutions to several variants of SLAM and BA.
A wide range of problems in robotics as well as in computer-vision involve the minimization of a non-linear error function that can be represented as a graph. Typical instances are simultaneous localization and mapping (SLAM) or bundle adjustment (BA). The overall goal in these problems is to find the configuration of parameters or state variables that maximally explain a set of measurements affected by Gaussian noise. g2o is an open-source C++ framework for such nonlinear least squares problems. g2o has been designed to be easily extensible to a wide range of problems and a new problem typically can be specified in a few lines of code. The current implementation provides solutions to several variants of SLAM and BA.
Currently, this project doesn't support writing user-defined types in python, but the predefined types are enough to implement the most common algorithms, say **PnP, ICP, Bundle Adjustment and Pose Graph Optimization** in 2d or 3d scenarios. g2o's visualization part is not wrapped, if you want to visualize point clouds or graph, you can give [pangolin](https://github.com/uoip/pangolin) a try, it's a python binding of C++ library [Pangolin](http://github.com/stevenlovegrove/Pangolin).
For convenience, some frequently used Eigen types (Quaternion, Rotation2d, Isometry3d, Isometry2d, AngleAxis) are packed into this library.
In the contrib folder, I collected some useful 3rd-party C++ code related to g2o, like robust pose graph optimization library [vertigo](http://www.openslam.org/vertigo), stereo sba and smooth estimate propagator from [sptam](https://github.com/lrse/sptam).
## Requirements
* [C++ requirements](#g2oRequirements).
([pybind11](https://github.com/pybind/pybind11) is also required, but it's built in this repository, you don't need to install)
## Installation
```
git clone https://github.com/uoip/g2opy.git
cd g2opy
mkdir build
cd build
cmake ..
make -j8
cd ..
python setup.py install
```
Tested under Ubuntu 16.04, Python 3.6+.
## Get Started
The code snippets below show the core parts of BA and Pose Graph Optimization in a SLAM system.
#### Bundle Adjustment
```python
import numpy
import g2o
class BundleAdjustment(g2o.SparseOptimizer):
def __init__(self, ):
super().__init__()
solver = g2o.BlockSolverSE3(g2o.LinearSolverCSparseSE3())
solver = g2o.OptimizationAlgorithmLevenberg(solver)
super().set_algorithm(solver)
def optimize(self, max_iterations=10):
super().initialize_optimization()
super().optimize(max_iterations)
def add_pose(self, pose_id, pose, cam, fixed=False):
sbacam = g2o.SBACam(pose.orientation(), pose.position())
sbacam.set_cam(cam.fx, cam.fy, cam.cx, cam.cy, cam.baseline)
v_se3 = g2o.VertexCam()
v_se3.set_id(pose_id * 2) # internal id
v_se3.set_estimate(sbacam)
v_se3.set_fixed(fixed)
super().add_vertex(v_se3)
def add_point(self, point_id, point, fixed=False, marginalized=True):
v_p = g2o.VertexSBAPointXYZ()
v_p.set_id(point_id * 2 + 1)
v_p.set_estimate(point)
v_p.set_marginalized(marginalized)
v_p.set_fixed(fixed)
super().add_vertex(v_p)
def add_edge(self, point_id, pose_id,
measurement,
information=np.identity(2),
robust_kernel=g2o.RobustKernelHuber(np.sqrt(5.991))): # 95% CI
edge = g2o.EdgeProjectP2MC()
edge.set_vertex(0, self.vertex(point_id * 2 + 1))
edge.set_vertex(1, self.vertex(pose_id * 2))
edgExcerpt of 15,389 characters
Read on GitHub3
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:584a8fe788f2a773, topic:slam, readme:robotics, desc:slam