File tree Expand file tree Collapse file tree 4 files changed +22
-2
lines changed
Expand file tree Collapse file tree 4 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ IncrementalTriangulator::Options IncrementalMapperOptions::Triangulation()
212212BundleAdjustmentOptions IncrementalMapperOptions::LocalBundleAdjustment ()
213213 const {
214214 BundleAdjustmentOptions options;
215- options.solver_options .function_tolerance = 0.0 ;
215+ options.solver_options .function_tolerance = ba_local_function_tolerance ;
216216 options.solver_options .gradient_tolerance = 10.0 ;
217217 options.solver_options .parameter_tolerance = 0.0 ;
218218 options.solver_options .max_num_iterations = ba_local_max_num_iterations;
@@ -237,7 +237,7 @@ BundleAdjustmentOptions IncrementalMapperOptions::LocalBundleAdjustment()
237237BundleAdjustmentOptions IncrementalMapperOptions::GlobalBundleAdjustment ()
238238 const {
239239 BundleAdjustmentOptions options;
240- options.solver_options .function_tolerance = 0.0 ;
240+ options.solver_options .function_tolerance = ba_global_function_tolerance ;
241241 options.solver_options .gradient_tolerance = 1.0 ;
242242 options.solver_options .parameter_tolerance = 0.0 ;
243243 options.solver_options .max_num_iterations = ba_global_max_num_iterations;
Original file line number Diff line number Diff line change @@ -93,6 +93,9 @@ struct IncrementalMapperOptions {
9393 // The number of images to optimize in local bundle adjustment.
9494 int ba_local_num_images = 6 ;
9595
96+ // Ceres solver function tolerance for local bundle adjustment
97+ double ba_local_function_tolerance = 0.0 ;
98+
9699 // The maximum number of local bundle adjustment iterations.
97100 int ba_local_max_num_iterations = 25 ;
98101
@@ -108,6 +111,9 @@ struct IncrementalMapperOptions {
108111 int ba_global_images_freq = 500 ;
109112 int ba_global_points_freq = 250000 ;
110113
114+ // Ceres solver function tolerance for global bundle adjustment
115+ double ba_global_function_tolerance = 0.0 ;
116+
111117 // The maximum number of global bundle adjustment iterations.
112118 int ba_global_max_num_iterations = 50 ;
113119
Original file line number Diff line number Diff line change @@ -1054,6 +1054,11 @@ int RunMapper(int argc, char** argv) {
10541054 mapper.Start ();
10551055 mapper.Wait ();
10561056
1057+ if (reconstruction_manager.Size () == 0 ) {
1058+ std::cerr << " ERROR: failed to create sparse model" << std::endl;
1059+ return EXIT_FAILURE;
1060+ }
1061+
10571062 // In case the reconstruction is continued from an existing reconstruction, do
10581063 // not create sub-folders but directly write the results.
10591064 if (input_path != " " && reconstruction_manager.Size () > 0 ) {
@@ -1093,6 +1098,11 @@ int RunHierarchicalMapper(int argc, char** argv) {
10931098 hierarchical_mapper.Start ();
10941099 hierarchical_mapper.Wait ();
10951100
1101+ if (reconstruction_manager.Size () == 0 ) {
1102+ std::cerr << " ERROR: failed to create sparse model" << std::endl;
1103+ return EXIT_FAILURE;
1104+ }
1105+
10961106 reconstruction_manager.Write (output_path, &options);
10971107
10981108 return EXIT_SUCCESS;
Original file line number Diff line number Diff line change @@ -504,6 +504,8 @@ void OptionManager::AddMapperOptions() {
504504 &mapper->ba_min_num_residuals_for_multi_threading );
505505 AddAndRegisterDefaultOption (" Mapper.ba_local_num_images" ,
506506 &mapper->ba_local_num_images );
507+ AddAndRegisterDefaultOption (" Mapper.ba_local_function_tolerance" ,
508+ &mapper->ba_local_function_tolerance );
507509 AddAndRegisterDefaultOption (" Mapper.ba_local_max_num_iterations" ,
508510 &mapper->ba_local_max_num_iterations );
509511 AddAndRegisterDefaultOption (" Mapper.ba_global_use_pba" ,
@@ -518,6 +520,8 @@ void OptionManager::AddMapperOptions() {
518520 &mapper->ba_global_images_freq );
519521 AddAndRegisterDefaultOption (" Mapper.ba_global_points_freq" ,
520522 &mapper->ba_global_points_freq );
523+ AddAndRegisterDefaultOption (" Mapper.ba_global_function_tolerance" ,
524+ &mapper->ba_global_function_tolerance );
521525 AddAndRegisterDefaultOption (" Mapper.ba_global_max_num_iterations" ,
522526 &mapper->ba_global_max_num_iterations );
523527 AddAndRegisterDefaultOption (" Mapper.ba_global_max_refinements" ,
You can’t perform that action at this time.
0 commit comments