fixstars / cuda-bundle-adjustment

A CUDA implementation of Bundle Adjustment
Apache License 2.0
373 stars 46 forks source link

Can you support the following two types of edges: g2o::EdgeSE3Expmap #4

Closed twoeggs closed 3 years ago

twoeggs commented 3 years ago

Hi! Can you support the following two types of edges:

g2o::EdgeSE3Expmap g2o::EdgeSBACam

atakagi-fixstars commented 3 years ago

Hi, @twoeggs

Thank you for your request. Please tell me if there are any applications where those edges are used.

Regards,

twoeggs commented 3 years ago

Hi,@atakagi-fixstars

These two edges are currently used in rtabmap:

https://github.com/introlab/rtabmap/blob/noetic-devel/corelib/src/optimizer/OptimizerG2O.cpp#L1459

thanks!

atakagi-fixstars commented 3 years ago

Hi, @twoeggs

I checked about g2o::EdgeSE3Expmap.

My understanding is

Thus, supporting g2o::EdgeSE3Expmap is relatively easy. 😄 I'm willing to implement, but I can't say when it will be completed. Please wait patiently.

I'm also checking g2o::EdgeSBACam.

Regards,

lamer-afk commented 3 years ago

Hi, @twoeggs

I checked about g2o::EdgeSE3Expmap.

My understanding is

  • this edge constrains relational pose between two frames
  • it leads to additional non-zero block to "H matrix" of linear system (HΔx=b)
  • implementation of linear solver or after process do not need to be changed

Thus, supporting g2o::EdgeSE3Expmap is relatively easy. 😄 I'm willing to implement, but I can't say when it will be completed. Please wait patiently.

I'm also checking g2o::EdgeSBACam.

Regards,

Hi, @atakagi-fixstars I also want to implement g2o::EdgeSE3Expmap,i think it should be done in the following steps:

  1. Add new computeJacobians method and new computeActiveErrors method for edgeSE3Expmap
  2. Hpp is no longer a diagonal matrix. modify Hpp from Vertor to Matrix
  3. Modify the value of the Bp
  4. Modify the non-zero of the Hsc

But now I don't understand why HSC is an upper triangular matrix?! Look at this formula :HSc = Hpp - Hpl*Hll^-1*HplT HSC should be a symmetric matrix instead of an upper triangular matrix

But your code (HschurSparseBlockMatrix: : constructFromVertices) is an upper triangular matrix, I don't understand why is this.

Regards

atakagi-fixstars commented 3 years ago

Hi, @lamer-afk

Thank you for your detailed explanation! Your implementation idea is correct.

But now I don't understand why HSC is an upper triangular matrix?! HSC should be a symmetric matrix instead of an upper triangular matrix

Yes, HSC is mathematically symmetric. We store only upper triangular part of HSC because it is computationally efficient. It is same way as g2o.

Regards,