Skip to content

Commit cbb0b5e

Browse files
authored
add more options in CLI and add support to optimize principal point (#170)
* add more options in CLI and add support to optimize principal point * d * by default, do not optimize pp
1 parent 18a70ee commit cbb0b5e

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

glomap/controllers/option_manager.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ void OptionManager::AddBundleAdjusterOptions() {
205205
&mapper->opt_ba.optimize_translation);
206206
AddAndRegisterDefaultOption("BundleAdjustment.optimize_intrinsics",
207207
&mapper->opt_ba.optimize_intrinsics);
208+
AddAndRegisterDefaultOption("BundleAdjustment.optimize_principal_point",
209+
&mapper->opt_ba.optimize_principal_point);
208210
AddAndRegisterDefaultOption("BundleAdjustment.optimize_points",
209211
&mapper->opt_ba.optimize_points);
210212
AddAndRegisterDefaultOption("BundleAdjustment.thres_loss_function",
@@ -234,6 +236,14 @@ void OptionManager::AddInlierThresholdOptions() {
234236
return;
235237
}
236238
added_inliers_options_ = true;
239+
AddAndRegisterDefaultOption("Thresholds.max_angle_error",
240+
&mapper->inlier_thresholds.max_angle_error);
241+
AddAndRegisterDefaultOption(
242+
"Thresholds.max_reprojection_error",
243+
&mapper->inlier_thresholds.max_reprojection_error);
244+
AddAndRegisterDefaultOption(
245+
"Thresholds.min_triangulation_angle",
246+
&mapper->inlier_thresholds.min_triangulation_angle);
237247
AddAndRegisterDefaultOption("Thresholds.max_epipolar_error_E",
238248
&mapper->inlier_thresholds.max_epipolar_error_E);
239249
AddAndRegisterDefaultOption("Thresholds.max_epipolar_error_F",

glomap/estimators/bundle_adjustment.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ void BundleAdjuster::ParameterizeVariables(
161161
images[center].cam_from_world.translation.data());
162162

163163
// Parameterize the camera parameters, or set them to be constant if desired
164-
if (options_.optimize_intrinsics) {
164+
if (options_.optimize_intrinsics && !options_.optimize_principal_point) {
165165
for (auto& [camera_id, camera] : cameras) {
166166
if (problem_->HasParameterBlock(camera.params.data())) {
167167
std::vector<int> principal_point_idxs;
@@ -174,8 +174,8 @@ void BundleAdjuster::ParameterizeVariables(
174174
camera.params.data());
175175
}
176176
}
177-
178-
} else {
177+
} else if (!options_.optimize_intrinsics &&
178+
!options_.optimize_principal_point) {
179179
for (auto& [camera_id, camera] : cameras) {
180180
if (problem_->HasParameterBlock(camera.params.data())) {
181181
problem_->SetParameterBlockConstant(camera.params.data());

glomap/estimators/bundle_adjustment.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ struct BundleAdjusterOptions : public OptimizationBaseOptions {
1414
bool optimize_rotations = true;
1515
bool optimize_translation = true;
1616
bool optimize_intrinsics = true;
17+
bool optimize_principal_point = false;
1718
bool optimize_points = true;
1819

1920
// Constrain the minimum number of views per track

0 commit comments

Comments
 (0)