best way to hold a parameter constant?

2,605 views
Skip to first unread message

Thomas Sharpless

unread,
Feb 22, 2016, 11:49:08 AM2/22/16
to Ceres Solver
I have a cost function that depends on 9 camera parameters.  I would like to hold certain of those constant in some runs and let them vary in others.
Can this be done without rewriting the cost function?  If so, what is the recommended way?

I have already discovered that trying to alias parameter blocks does not work, ceres is too smart for that.

Sameer Agarwal

unread,
Feb 22, 2016, 11:53:03 AM2/22/16
to Ceres Solver
Use a SubsetParameterization.
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/0fa56ab2-00b8-4be1-ab89-7cfded87c368%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pierre Moulon

unread,
Feb 22, 2016, 11:55:58 AM2/22/16
to ceres-...@googlegroups.com
You define wich part of your parameter must remains const and it is done ;-)

Regards/Cordialement,
Pierre M

Thomas Sharpless

unread,
Feb 22, 2016, 12:24:06 PM2/22/16
to Ceres Solver
SubsetParametrization would appear to be the right thing.  However when I do this:
    vector<int> sspv; // indices to hold constant
    sspv.push_back(8);
    if( sspv.size() > 0 ){
        ceres::SubsetParameterization cssp( 9, sspv );
        cprob.SetParameterization( cam2, &cssp);
    }
I get a runtime error: "pure virtual function called" when solve() tries to call cam2::LocalSize().  That is puzzling, as LocalParametrization.h seems to define that fn,
This with MSVC2013.

Sameer Agarwal

unread,
Feb 22, 2016, 12:25:10 PM2/22/16
to Ceres Solver
for one you are allocating on the stack and passing ownership to ceres, that seems like a recipe for trouble.

--
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.

Thomas Sharpless

unread,
Feb 22, 2016, 12:36:13 PM2/22/16
to Ceres Solver
Correct as usual, Sameer
This succeeds:
    if( sspv.size() > 0 ){
        ceres::SubsetParameterization *pcssp
            = new ceres::SubsetParameterization( 9, sspv );
        cprob.SetParameterization( cam2, pcssp);
    }

 
On Monday, February 22, 2016 at 11:49:08 AM UTC-5, Thomas Sharpless wrote:
Reply all
Reply to author
Forward
0 new messages