# EKF slam vs global bundle adjustment

How does EKF slam and the covariance matrix interact with global bundle adjustment?

In particular the covariance matrix gives you a confidence on location but global bundle adjustment does not. How do you use the confidences when running global bundle adjustment?

I am assuming your pipeline is that you are running an EKF SLAM algorithm over some data to estimate a set of initial poses and landmarks, and then you feed all of these states into a global bundle adjustment.

In particular the covariance matrix gives you a confidence on location but global bundle adjustment does not.

First things first is that the global bundle adjustment algorithm does give you the confidence of the states(poses, and landmarks). It is just called something different typically the Hessian or more commonly the Information Matrix($$I$$). The Information Matrix is just the matrix inverse of the covariance matrix and vice versa. So if you are more comfortable in working with the covariance matrix($$C$$) then you can just do that operation first.

$$C = I^{-1}$$

This page for Ceres which is commonly used to solve bundle adjustment problems has a good description of how to extract the covariance.

If you want to do it manually you need to compute your Jacobians($$J$$), form the Hessian($$H$$), and then invert it to get the covariance.

$$C = (J^T*J)^{-1} = H^{-1}$$

How do you use the confidences when running global bundle adjustment?

This is actually kind of difficult to do and very much depends on how you want your EKF algorithm to interact with your Bundle adjustment algorithm. I would say the general approach people do is ignore the EKF covariances for your pose and landmarks. Instead your measurements/factors(e.g the reprojection error) each have their own uncertainty just like in the EKF. And your global bundle adjustment uncertainty would come from those.

If you really want to apply the uncertainty from your EKF algorithm then you would instead set a prior measurement/factor on each pose/landmark and you would set the measurement uncertainty to be equal to the EKF's uncertainty.

• Thanks, Could you explain or link me to that definition of covariance? I do not understand how it came to be. Apr 16, 2022 at 3:10
• This page(sherrytowers.com/mle_introduction.pdf) mentions the Information matrix, and how its inverse is the variance, and that it is related to the Hessian. How to form the Hessian for a non linear least squares problem can be found in this tutorial(www2.imm.dtu.dk/pubdb/edoc/imm3215.pdf). I also recommend reading through the Ceres docs(ceres-solver.org/nnls_covariance.html) cause it has some of the details. Apr 17, 2022 at 19:20
• Thanks, got it. Apr 17, 2022 at 20:04