Example code of BundleAdjustment for estimating intrinsics and distortion along with pose and points using analytically derived jacobians.

269 views
Skip to first unread message

Brothers on the Road

unread,
Apr 19, 2021, 6:37:13 AM4/19/21
to Ceres Solver
Hi, 
I've been using Ceres to solve a large-scale BA problem that requires me to estimate Camera Intrinsics/distortion along with Pose and Point locations. Until now I was using AutoDiff to get the job done and although the results are good, the final error in Camera poses continues to remain perceptible, and optimization too takes very long time. 

I am hoping to see if using analytically derived jacobians can help me solve these problems. I've gone through this code https://fzheng.me/2018/01/23/ba-demo-ceres/ already. If anyone could share an open-source code that gives me a better head-start  to solving this problem it'll be very helpful or give me pointers to integrate cam intrinsics and distortion to the analytically derived model.

Regards, 
Sal. 

Sameer Agarwal

unread,
Apr 19, 2021, 11:53:03 AM4/19/21
to ceres-...@googlegroups.com
Hi Sal,
Have you looked at the libmv examples?
if you share the output of your Summary:FullReport we maybe able to say more about what is going on.
Sameer


--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/dce1f21d-e1e6-4142-9944-6b4bc5ee20d6n%40googlegroups.com.

Brothers on the Road

unread,
Apr 20, 2021, 4:33:41 AM4/20/21
to Ceres Solver
Hi Sameer,
Thank you for the quick response, I haven't gone through libmv examples yet. It doesn't seem to use ceres but I will go through it in any case. Attaching the summary and intermediary output. 

Regards,
Sal.
ceresoutsummary.txt

Sameer Agarwal

unread,
Apr 20, 2021, 9:32:12 AM4/20/21
to ceres-...@googlegroups.com
Why are you not use SPARSE_SCHUR or DENSE_SCHUR as your linear solver?
Sameer


Brothers on the Road

unread,
Apr 20, 2021, 10:37:29 AM4/20/21
to Ceres Solver

Hi,
I did try it out before as well, it yielded similar results. I've just run it again and I'm attaching it's output. The final cost pretty much remains the same. 

Regards,
Sal.
ceresoutsummary_dense_schur.txt

Sameer Agarwal

unread,
Apr 20, 2021, 12:22:14 PM4/20/21
to ceres-...@googlegroups.com
Do you have varying size parameter blocks (say shared calibration parameters) for your cameras? if not then you should consider giving an ordering instead of using an automatic one.
also thats an insane number of 3d points for that number of cameras.
Sameer


Brothers on the Road

unread,
Apr 21, 2021, 9:46:54 AM4/21/21
to Ceres Solver
Hi sameer, 
Yes, the intrinsics (fx, fy, cx, cy) and distortion params (k1, k2, t1, t2)  are shared across all cameras, I am adding the cost function class and the function which adds the residual blocks from tracks. There are 235 cameras and about 600,000 3d points. Do you recommend I reduce the number of 3d points ?
.
Regards,
Sal.

track.txt
BAcostfunc.txt

Sameer Agarwal

unread,
Apr 23, 2021, 3:13:25 PM4/23/21
to ceres-...@googlegroups.com
okay that makes sense.
The number of 3d points does seem excessive.  I think a couple of hundred points per camera (well distributed) should be plenty.
Sameer


Reply all
Reply to author
Forward
0 new messages