simple_bundle_adjuster implement

172 views
Skip to first unread message

ThyMy

unread,
Jan 4, 2018, 2:39:48 PM1/4/18
to Ceres Solver
Hi,

I'm trying to apply the example simple_bundle_adjuster on my data and got this error when compiling:

/usr/local/include/ceres/internal/variadic_evaluate.h:166:19: error: no match for call to ‘(const MyFuncError) (const ceres::Jet<double, 13>* const&, const ceres::Jet<double, 13>* const&, ceres::Jet<double, 13>*&)’
     return functor(input[0],
...note: candidate: bool MyFuncError::operator()(const double*, const double*, double*) const
   bool operator()(const double* const parameters,
no known conversion for argument 1 from ‘const ceres::Jet<double, 13>* const’ to ‘const double*’


My autodiff function is:
static ceres::CostFunction* Create(const double yk,
                                                    const double x_,
                                      const double y_) {
    return (new ceres::AutoDiffCostFunction<MyFuncError, 1, 4, 9>(
                new MyFuncError(yk, x_, y_)));
  }


I'm very new to Ceres, I've tried many other ways but could not figure out what the root problem is, in fact it is based almost all the simple_bundle_adjuster example.

Thanks,

Sameer Agarwal

unread,
Jan 4, 2018, 4:33:16 PM1/4/18
to ceres-...@googlegroups.com
can you share the implementation of MyFuncError?

--
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/45b17ce7-d27b-408b-98d6-a60fa530cf00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Keir Mierle

unread,
Jan 4, 2018, 6:29:32 PM1/4/18
to ceres-...@googlegroups.com
Based on the error message, it looks like you're trying to pass a jet argument to a double argument, maybe in a function pointer. That's not supported because it would zap the derivatives.

See this writeup:

There is also a thread from the other day about this that has more info; it may be relevant to you.

On Thu, Jan 4, 2018 at 1:33 PM, 'Sameer Agarwal' via Ceres Solver <ceres-...@googlegroups.com> wrote:
can you share the implementation of MyFuncError?
On Thu, Jan 4, 2018 at 11:39 AM ThyMy <thymy....@gmail.com> wrote:
Hi,

I'm trying to apply the example simple_bundle_adjuster on my data and got this error when compiling:

/usr/local/include/ceres/internal/variadic_evaluate.h:166:19: error: no match for call to ‘(const MyFuncError) (const ceres::Jet<double, 13>* const&, const ceres::Jet<double, 13>* const&, ceres::Jet<double, 13>*&)’
     return functor(input[0],
...note: candidate: bool MyFuncError::operator()(const double*, const double*, double*) const
   bool operator()(const double* const parameters,
no known conversion for argument 1 from ‘const ceres::Jet<double, 13>* const’ to ‘const double*’


My autodiff function is:
static ceres::CostFunction* Create(const double yk,
                                                    const double x_,
                                      const double y_) {
    return (new ceres::AutoDiffCostFunction<MyFuncError, 1, 4, 9>(
                new MyFuncError(yk, x_, y_)));
  }


I'm very new to Ceres, I've tried many other ways but could not figure out what the root problem is, in fact it is based almost all the simple_bundle_adjuster example.

Thanks,

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUAggakeXoKJDBQmECSp5X4Q%3DJ_neF8n2ok9jt5PrsyGvg%40mail.gmail.com.
Message has been deleted

Sameer Agarwal

unread,
Jan 5, 2018, 6:06:07 AM1/5/18
to ceres-...@googlegroups.com
Doreen,

You are trying to use a untemplated cost functor which is defined using doubles as a functor for autodiffcostfunction. This is not going to work, as AutoDiffCostFunction uses two different types, doubles and Jets to instantiate the Functor.

To understand why this is the case, have a look at


Now, you can go two routes. You can either use NumericDiffCostFunction with your current functor. Which should work. The other is to templatize it. 

Your code looks straightforward to templatize.

Sameer


On Fri, Jan 5, 2018 at 12:04 AM Doreen <thymy....@gmail.com> wrote:
I tried to use template T, but it has some problem when declaring the Eigen Matrix type, hence I  changed all to use type double.

I also thought that I passed some Jet argument to double argument, but could not figure out where as this is my first coding using Ceres.

Thanks a lot.

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

Doreen

unread,
Jan 5, 2018, 7:05:18 AM1/5/18
to Ceres Solver
Hi,

it now works with NumericDiffCostFunction.

Thank you very much.
Reply all
Reply to author
Forward
0 new messages