Pose covariance

533 views
Skip to first unread message

Alessandro Dal Grande

unread,
Nov 25, 2014, 10:13:38 PM11/25/14
to ceres-...@googlegroups.com
If I am optimizing the pose with Ceres, how can I get the final covariance?

Thanks

Alessandro Dal Grande

unread,
Nov 25, 2014, 10:17:33 PM11/25/14
to ceres-...@googlegroups.com
PS: ideally I am wanting to get a 6x6 covariance matrix of the current pose like in PTAM, if it's more helpful.

Thanks

Sameer Agarwal

unread,
Nov 25, 2014, 10:50:05 PM11/25/14
to ceres-...@googlegroups.com

By using the covariance class included with Ceres.


--
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/b94c18fd-c045-4029-8ecd-75806e643746%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alessandro Dal Grande

unread,
Nov 25, 2014, 10:51:51 PM11/25/14
to ceres-...@googlegroups.com
Hey Sameer,

I went and tried to implement like in the example, but I am left with a question: if I am optimizing one camera and the points are fixed, what should I use as covariance blocks?

Thanks a lot

Alessandro Dal Grande

unread,
Nov 25, 2014, 10:55:44 PM11/25/14
to ceres-...@googlegroups.com
Seeing what these guys did, they make a pair with the same camera?

Sameer Agarwal

unread,
Nov 26, 2014, 2:05:54 AM11/26/14
to ceres-...@googlegroups.com
you want the diagonal covariance block corresponding to your camera. so yes you ask for the covariance block corresponding to (camera, camera). does that make sense?
Sameer


Alessandro Dal Grande

unread,
Nov 26, 2014, 3:03:30 AM11/26/14
to ceres-...@googlegroups.com
Yes, will test that.

Thanks

Alessandro Dal Grande

unread,
Dec 1, 2014, 12:50:01 AM12/1/14
to ceres-...@googlegroups.com
Hey Sameer,

I didn't get to the covariance yet, the coding is aborting on this:

CHECK(covarianceCalculator.Compute(covarianceBlocks, &problem));

My full code for this part is:

 ceres::Covariance::Options covarianceOptions;
 ceres
::Covariance covarianceCalculator(covarianceOptions);
 vector
<pair<const double*, const double*> > covarianceBlocks;
 
double packedCamera[9];
 
...
 covarianceBlocks
.push_back(make_pair(packedCamera, packedCamera));
 CHECK
(covarianceCalculator.Compute(covarianceBlocks, &problem));

It seems it cannot find an item of some collection and then the logger (the one for Android/iOS) aborts as it is a fatal error.

What does it expect I feed it in? My problem blocks are originally set like this:

problem.AddResidualBlock(costFunction, lossFunction, packedCamera, packedPoint);

Thanks

Sameer Agarwal

unread,
Dec 1, 2014, 1:18:43 AM12/1/14
to ceres-...@googlegroups.com
can you post the full error log?

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

Alessandro Dal Grande

unread,
Dec 1, 2014, 1:47:25 AM12/1/14
to ceres-...@googlegroups.com
The log is as following:

map_util.h:62 Check failed: it != collection.end() Map key not found: 0x11e94e0

* thread #4: tid = 0x4875c, 0x39ea4dfc libsystem_kernel.dylib`__pthread_kill + 8, queue = '', stop reason = signal SIGABRT

    frame
#0: 0x39ea4dfc libsystem_kernel.dylib`__pthread_kill + 8

    frame
#1: 0x39f24d12 libsystem_pthread.dylib`pthread_kill + 62

    frame
#2: 0x39e44938 libsystem_c.dylib`abort + 76

    frame
#3: 0x004d0d40 MessageLogger::~MessageLogger() + 432

    frame
#4: 0x0049a9c0 std::__1::map<double const*, int, std::__1::less<double const*>, std::__1::allocator<std::__1::pair<double const* const, int> > >::value_type::second_type const& ceres::FindOrDie<std::__1::map<double const*, int, std::__1::less<double const*>, std::__1::allocator<std::__1::pair<double const* const, int> > > >(std::__1::map<double const*, int, std::__1::less<double const*>, std::__1::allocator<std::__1::pair<double const* const, int> > > const&, std::__1::map<double const*, int, std::__1::less<double const*>, std::__1::allocator<std::__1::pair<double const* const, int> > >::value_type::first_type const&) + 240

    frame
#5: 0x0049864a ceres::internal::CovarianceImpl::ComputeCovarianceSparsity(std::__1::vector<std::__1::pair<double const*, double const*>, std::__1::allocator<std::__1::pair<double const*, double const*> > > const&, ceres::internal::ProblemImpl*) + 794

    frame
#6: 0x0049830c ceres::internal::CovarianceImpl::Compute(std::__1::vector<std::__1::pair<double const*, double const*>, std::__1::allocator<std::__1::pair<double const*, double const*> > > const&, ceres::internal::ProblemImpl*) + 68

 
* frame #7: 0x00123cce +[BundleAdjustment optimizePose:withCorrespondencies:](self=0x005a7870, _cmd=0x00587b1c, keyframe=0x167b40a0, correspondencies=<unavailable>) + 5262 at BundleAdjustment.mm:214


Thanks

Sameer Agarwal

unread,
Dec 1, 2014, 2:23:39 AM12/1/14
to ceres-...@googlegroups.com
did you by chance mark the camera block as constant?


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

Alessandro Dal Grande

unread,
Dec 1, 2014, 2:34:31 AM12/1/14
to ceres-...@googlegroups.com
Part of it (the intrisics):

vector<int> constantIntrinsics;
 
 
// set focal, px, py constant
  constantIntrinsics
.push_back(6);
  constantIntrinsics
.push_back(7);
  constantIntrinsics
.push_back(8);
 
  ceres
::SubsetParameterization *constantIntrinsicsParametrization = new ceres::SubsetParameterization(9, constantIntrinsics);

Alessandro Dal Grande

unread,
Dec 1, 2014, 2:41:45 AM12/1/14
to ceres-...@googlegroups.com
The points are also marked constant.

Sameer Agarwal

unread,
Dec 1, 2014, 2:46:06 AM12/1/14
to ceres-...@googlegroups.com
hmm that should not be a problem. can you share the full code fragment?

Greg Anders

unread,
Jul 30, 2017, 7:40:30 PM7/30/17
to Ceres Solver
I know this is an old thread, but did you ever figure out the solution? I am having the exact same problem (the same error of it != collection.end() Map key not found)

Alessandro Dal Grande

unread,
Jul 30, 2017, 7:53:25 PM7/30/17
to Ceres Solver
I think I solved it, but being years ago I unfortunately don't remember how. My suggestion is try to break down and simplify the problem as much as you can, and then add back logic step by step.
Reply all
Reply to author
Forward
0 new messages