Skip to content

Commit 484667b

Browse files
authored
Check if value is set to avoid out-of-bound indexing (#178)
1 parent 262e122 commit 484667b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

glomap/estimators/bundle_adjustment.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,13 @@ void BundleAdjuster::ParameterizeVariables(
208208
}
209209
}
210210

211-
// Set the first camera to be fixed to remove the gauge ambiguity.
212-
problem_->SetParameterBlockConstant(
213-
images[center].cam_from_world.rotation.coeffs().data());
214-
problem_->SetParameterBlockConstant(
215-
images[center].cam_from_world.translation.data());
211+
if (counter > 0) {
212+
// Set the first camera to be fixed to remove the gauge ambiguity.
213+
problem_->SetParameterBlockConstant(
214+
images[center].cam_from_world.rotation.coeffs().data());
215+
problem_->SetParameterBlockConstant(
216+
images[center].cam_from_world.translation.data());
217+
}
216218

217219
// Parameterize the camera parameters, or set them to be constant if desired
218220
if (options_.optimize_intrinsics && !options_.optimize_principal_point) {

0 commit comments

Comments
 (0)