本文整理汇总了C++中NonlinearFactorGraph::addExpressionFactor方法的典型用法代码示例。如果您正苦于以下问题:C++ NonlinearFactorGraph::addExpressionFactor方法的具体用法?C++ NonlinearFactorGraph::addExpressionFactor怎么用?C++ NonlinearFactorGraph::addExpressionFactor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NonlinearFactorGraph
的用法示例。
在下文中一共展示了NonlinearFactorGraph::addExpressionFactor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]) {
// parse options and read BAL file
SfM_data db = preamble(argc, argv);
// Build graph using conventional GeneralSFMFactor
NonlinearFactorGraph graph;
for (size_t j = 0; j < db.number_tracks(); j++) {
BOOST_FOREACH (const SfM_Measurement& m, db.tracks[j].measurements) {
size_t i = m.first;
Point2 z = m.second;
Pose3_ camTnav_(C(i));
Cal3Bundler_ calibration_(K(i));
Point3_ nav_point_(P(j));
graph.addExpressionFactor(
gNoiseModel, z,
uncalibrate(calibration_, // now using transform_from !!!:
project(transform_from(camTnav_, nav_point_))));
}
}
Values initial;
size_t i = 0, j = 0;
BOOST_FOREACH (const SfM_Camera& camera, db.cameras) {
initial.insert(C(i), camera.pose().inverse()); // inverse !!!
initial.insert(K(i), camera.calibration());
i += 1;
}
BOOST_FOREACH (const SfM_Track& track, db.tracks)
initial.insert(P(j++), track.p);
bool separateCalibration = true;
return optimize(db, graph, initial, separateCalibration);
}