Setting Parameter Weights or Covariance Values

1,286 views
Skip to first unread message

Susan Munn

unread,
Apr 21, 2014, 11:54:56 AM4/21/14
to ceres-...@googlegroups.com
Hi,

I'm trying to use Ceres Solver for Bundle Adjustment.  I've looked at the documentation and example.  I am currently using it "successfully" as in the basic bundle adjustment example but would like to add more constraints.  I don't see how to set weights for the parameters.  For instance, I want to say the intrinsic camera parameters (f, principle point) have fairly high confidence (low weights) and the extrinsic parameters should be adjusted more (high weights), by inputting weights for each parameter.  I'm currently keeping the focal length and principal point as const members of my AutoDiffCostFunction class to hold them constant (so they aren't even considered "parameters"), but I'd like to allow them to adjust a small amount, just much less than the other parameters.  I'd also like to set limits on my parameters, if possible.  For instance, for my distortion parameters, the values should remain in the range of -0.5 to 0.5.  Are these things possible?  Is there an example for more advanced bundle adjustment via Ceres that I'm not seeing?  I see some remarks about "constant parameters" with "covariance blocks of zero" but don't see how to set these things.  Any help would be greatly appreciated.

Thank you,
Susan

Sameer Agarwal

unread,
Apr 21, 2014, 11:58:23 AM4/21/14
to ceres-...@googlegroups.com
Susan,
I think by weights on parameters you really mean priors on parameters. 

You can either add terms say a normal prior around your expected values to the objective function. Something like

1/2 (x - mu)^2/sigma^2.

You can use a NormalPrior to do this.

or you can use the  Problem::SetParameterUpperBound/SetParameterLowerBound to set hard limits. (Sorry the latter is not documented yet, its still work in progress but it should work).

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/12bb57cd-1839-4ad2-9b9f-ccd1ba0eb5bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Susan Munn

unread,
Apr 21, 2014, 1:24:46 PM4/21/14
to ceres-...@googlegroups.com
Thanks for the quick response.  I don't see the functions Problem::SetParameterUpperBound/SetParameterLowerBound.  Are they in Version 1.8.0?  I did a full solution search for "SetParameterUpperBound" and nothing came up, I also looked in problem.cc.

Sameer Agarwal

unread,
Apr 21, 2014, 1:25:18 PM4/21/14
to ceres-...@googlegroups.com
this is not in 1.8.0, this is in the master branch.
Sameer



Susan Munn

unread,
Apr 21, 2014, 3:53:24 PM4/21/14
to ceres-...@googlegroups.com
Sorry for all the questions.  

Is there a way to combine the functionality of AutoDiffCostFunction (where I define how to compute the error from the parameters and observations, and don't worry about the Jacobian) and NormalPrior (where I can set a covariance matrix)?  

And, are there any examples on the use of the NormalPrior class?

~Susan

Sameer Agarwal

unread,
Apr 21, 2014, 4:16:02 PM4/21/14
to ceres-...@googlegroups.com
normal prior is for a single parameter block.

if you want to put covariances on residuals you will have to cook up something on your own.
Sameer



Reply all
Reply to author
Forward
0 new messages