uoip / g2opy

Python binding of SLAM graph optimization framework g2o
668 stars 176 forks source link

Pose Optimization #49

Open aggelen opened 3 years ago

aggelen commented 3 years ago

I'm trying to implement a simple pose optimizer with 3 frames. I've calculated 3D points by triangulation. Then, I projected some of these points onto the 3rd frame. I have 3D pts. and projected points. I need to refine the camera pose at third frame. I've already looked through the examples but I couldn't figure out how to optimize it.

I'm not sure if this is the right method. It doesn't work for my data. It is like the image below. Green: actual point, red: projected point with predicted pose, magenta: projected point with optimized pose. Can you suggest anything? Thanks!

noSuccess0

Verbose Output for 10 iter: iteration= 0 chi2= 29.056211 time= 0.00258552 cumTime= 0.00258552 edges= 1935 schur= 1 lambda= 440.950594 levenbergIter= 1 iteration= 1 chi2= 22.221547 time= 0.00128042 cumTime= 0.00386594 edges= 1935 schur= 1 lambda= 146.983531 levenbergIter= 1 iteration= 2 chi2= 15.924198 time= 0.0012289 cumTime= 0.00509483 edges= 1935 schur= 1 lambda= 48.994510 levenbergIter= 1 iteration= 3 chi2= 10.866332 time= 0.00117517 cumTime= 0.00627001 edges= 1935 schur= 1 lambda= 16.331503 levenbergIter= 1 iteration= 4 chi2= 7.161353 time= 0.00117359 cumTime= 0.00744359 edges= 1935 schur= 1 lambda= 5.443834 levenbergIter= 1 iteration= 5 chi2= 4.878983 time= 0.00118739 cumTime= 0.00863098 edges= 1935 schur= 1 lambda= 1.814611 levenbergIter= 1 iteration= 6 chi2= 3.324435 time= 0.0011277 cumTime= 0.00975869 edges= 1935 schur= 1 lambda= 0.604870 levenbergIter= 1 iteration= 7 chi2= 2.154175 time= 0.00114915 cumTime= 0.0109078 edges= 1935 schur= 1 lambda= 0.201623 levenbergIter= 1 iteration= 8 chi2= 1.328496 time= 0.00118647 cumTime= 0.0120943 edges= 1935 schur= 1 lambda= 0.067208 levenbergIter= 1 iteration= 9 chi2= 0.794137 time= 0.00113145 cumTime= 0.0132258 edges= 1935 schur= 1 lambda= 0.022403 levenbergIter= 1 Total time elapsed: 1.6252547540025262

shaoxh commented 3 years ago

I still cannot use this package. when import an error shows up. #50 Do you have any idea how to tickle it?

LukasBommes commented 3 years ago

Take a look here: https://github.com/raulmur/ORB_SLAM2/blob/master/src/Optimizer.cc The method Optimizer::PoseOptimization performs pose optimization.