| 1201 | } |
| 1202 | |
| 1203 | void IncrementalMapper::IterativeLocalRefinement( |
| 1204 | const int max_num_refinements, |
| 1205 | const double max_refinement_change, |
| 1206 | const Options& options, |
| 1207 | const BundleAdjustmentOptions& ba_options, |
| 1208 | const IncrementalTriangulator::Options& tri_options, |
| 1209 | const image_t image_id) { |
| 1210 | BundleAdjustmentOptions custom_ba_options = ba_options; |
| 1211 | for (int i = 0; i < max_num_refinements; ++i) { |
| 1212 | const auto report = AdjustLocalBundle(options, |
| 1213 | custom_ba_options, |
| 1214 | tri_options, |
| 1215 | image_id, |
| 1216 | GetModifiedPoints3D()); |
| 1217 | VLOG(1) << "=> Merged observations: " << report.num_merged_observations; |
| 1218 | VLOG(1) << "=> Completed observations: " |
| 1219 | << report.num_completed_observations; |
| 1220 | VLOG(1) << "=> Filtered observations: " << report.num_filtered_observations; |
| 1221 | const double changed = |
| 1222 | report.num_adjusted_observations == 0 |
| 1223 | ? 0 |
| 1224 | : (report.num_merged_observations + |
| 1225 | report.num_completed_observations + |
| 1226 | report.num_filtered_observations) / |
| 1227 | static_cast<double>(report.num_adjusted_observations); |
| 1228 | VLOG(1) << StringPrintf("=> Changed observations: %.6f", changed); |
| 1229 | if (changed < max_refinement_change) { |
| 1230 | break; |
| 1231 | } |
| 1232 | // Only use robust cost function for first iteration. |
| 1233 | if (custom_ba_options.ceres) { |
| 1234 | custom_ba_options.ceres->loss_function_type = |
| 1235 | CeresBundleAdjustmentOptions::LossFunctionType::TRIVIAL; |
| 1236 | } |
| 1237 | } |
| 1238 | ClearModifiedPoints3D(); |
| 1239 | } |
| 1240 | |
| 1241 | void IncrementalMapper::IterativeGlobalRefinement( |
| 1242 | const int max_num_refinements, |
no test coverage detected