# What's the difference between factor graph optimization and bundle adjustment?

I see that in SLAM literature, factor graph optimization is frequently used. While in Structure from Motion (SfM) literature , they usually use bundle adjustment. What's the difference between the two methods?

Furthermore, can we implement one method with libraries for the other? E.g. implementing bundle adjustment with g2o, or implementing factor graph optimization with ceres solver?

The simplest explanation will be:

1. In structure from motion, it estimates structure(xyz points), camera locations, camera intrinsic.

2. In graph optimization, it only estimates camera locations. In the graph SLAM, the structure is just a by-product of a corrected trajectory or graph nodes.

E.g. implementing Bundle adjustment with g2o -> You can do it by modifying g2o but simply there is no reason to do that. g2o is not designed to estimate the structure and camera intrinsic. It doesn't mean that you can't estimate these but BA and SLAM are fundamentally different. You will end up changing 99% of the existing g2o code.

implementing factor graph optimization with ceres solver ? -> Ceres solver is an optimization library, not a bundle adjustment software although one of the ceres problem examples is bundle adjustmemt. Anyway, you can modify ceres bundle adjustment example to do graph optimization with a lot of modifications.

Factor graph optimization is a more general term that can be used in different contexts. It means you define a graph with nodes (states) and edges (constraints) and find a most likely configuration.

Bundle adjustment is a special type of problem that can be formulated as factor graph optimization.

Both g2o and Ceres can be used to implement bundle adjustment as well as other types of factor graph optimization problems. See also this question: https://stackoverflow.com/q/67155573/9152951