MCPcopy Create free account
hub / github.com/ComputationalRobotics/XM-code / Solve

Method Solve

deps/glomap/glomap/estimators/bundle_adjustment.cc:9–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace glomap {
8
9bool BundleAdjuster::Solve(const ViewGraph& view_graph,
10 std::unordered_map<camera_t, Camera>& cameras,
11 std::unordered_map<image_t, Image>& images,
12 std::unordered_map<track_t, Track>& tracks) {
13 // Check if the input data is valid
14 if (images.empty()) {
15 LOG(ERROR) << "Number of images = " << images.size();
16 return false;
17 }
18 if (tracks.empty()) {
19 LOG(ERROR) << "Number of tracks = " << tracks.size();
20 return false;
21 }
22
23 // Reset the problem
24 Reset();
25
26 // Add the constraints that the point tracks impose on the problem
27 AddPointToCameraConstraints(view_graph, cameras, images, tracks);
28
29 // Add the cameras and points to the parameter groups for schur-based
30 // optimization
31 AddCamerasAndPointsToParameterGroups(cameras, images, tracks);
32
33 // Parameterize the variables
34 ParameterizeVariables(cameras, images, tracks);
35
36 // Set the solver options.
37 ceres::Solver::Summary summary;
38
39 // Do not use the iterative solver, as it does not seem to be helpful
40 options_.solver_options.linear_solver_type = ceres::SPARSE_SCHUR;
41 options_.solver_options.preconditioner_type = ceres::CLUSTER_TRIDIAGONAL;
42
43 options_.solver_options.minimizer_progress_to_stdout = VLOG_IS_ON(2);
44 ceres::Solve(options_.solver_options, problem_.get(), &summary);
45 if (VLOG_IS_ON(2))
46 LOG(INFO) << summary.FullReport();
47 else
48 LOG(INFO) << summary.BriefReport();
49
50 return summary.IsSolutionUsable();
51}
52
53void BundleAdjuster::Reset() {
54 ceres::Problem::Options problem_options;

Callers 3

RunMapperFunction · 0.45
RunMapperResumeFunction · 0.45
SolveL1RegressionMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected