SFMExample_SmartFactor and SFMExample_SmartFactorPCG throws exception gtsam::ValuesIncorrectType

Issue #276 resolved
JzHuai0108 created an issue

I built the develop branch of gtsam 4.0 in Ubuntu 14.04. When executing the binary files for these two examples, examples/SFMExample_SmartFactor.cpp and examples/SFMExample_SmartFactorPCG.cpp, the exception of gtsam::ValuesIncorrectType was thrown.

I think this is because these two examples used initial values of type PinholePose<Cal3_S2>, however the SmartProjectionPoseFactor accepts types of Pose3, as indicated by its internal function cameras().

Comments (5)

  1. Frank Dellaert

    I'll be happy to review a proposed fix, if you think it's easy :-) Just do a pull request...

  2. JzHuai0108 reporter

    The solution to the type issue is straightforward. For either example, replace the Camera type with the Pose3 type in three lines. (1) // graph.push_back(PriorFactor<Camera>(0, Camera(poses[0],K), noise)); graph.push_back(PriorFactor<Pose3>(0, poses[0], noise)); (2)// graph.push_back(PriorFactor<Camera>(1, Camera(poses[0],K), noise)); graph.push_back(PriorFactor<Pose3>(1, poses[0],noise)); (3) // initialEstimate.insert(i, Camera(poses[i].compose(delta),K)); initialEstimate.insert(i, poses[i].compose(delta)); After that, both examples run through. SFMExample_SmartFactor gave estimates pretty close to the ground truth. However, SFMExample_SmartFactorPCG did not converge very well and none point was successfully triangulated with the estimated poses.

  3. Log in to comment